[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-win32
Subject:    msql-mysql-modules Digest 27 Jul 2001 13:48:12 -0000 Issue 209
From:       msql-mysql-modules-digest-help () lists ! mysql ! com
Date:       2001-07-27 13:48:12
[Download RAW message or body]

msql-mysql-modules Digest 27 Jul 2001 13:48:12 -0000 Issue 209

Topics (messages 1335 through 1344):

Re: Sorting w/ leading articles ignored
	1335 by: Dodger
	1336 by: Stefan Hinz

Re: quoting
	1337 by: Christopher Hicks
	1338 by: Jochen Wiedmann
	1342 by: Raul Dias
	1343 by: Dodger
	1344 by: Jochen Wiedmann

connection pool via connect_cached
	1339 by: Rajeev Rumale
	1340 by: Jochen Wiedmann

Bug in Makefile.PL
	1341 by: Maxwell Krohn

Administrivia:

To subscribe to the digest, e-mail:
	msql-mysql-modules-digest-subscribe@lists.mysql.com

To unsubscribe from the digest, e-mail:
	msql-mysql-modules-digest-unsubscribe@lists.mysql.com

To post to the list, e-mail:
	msql-mysql-modules@lists.mysql.com


----------------------------------------------------------------------

["msql-mysql-modules_1335.ezm" (message/rfc822)]

Message-ID: <000a01c11508$afcf3ac0$0a01a8c0@bens1.pa.home.com>
Reply-To: "Dodger" <sean@aquest.com>
From: "Dodger" <sean@aquest.com>
To: "Bin Zhang" <bzhang@hawaii.edu>,
	"Msql-Mysql-Modules" <msql-mysql-modules@lists.mysql.com>,
	"Mysql" <mysql@lists.mysql.com>
Subject: Re: Sorting w/ leading articles ignored
Date: Wed, 25 Jul 2001 08:52:39 -0400
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

In PHP specifically, no clue.

Using Perl, something like so (and this assumes a 1:1 mapping on
titles/ids):

my $get_art_list = $sql->prepare(<<"eosql");
SELECT title, id
  FROM table
eosql
$get_art_list->execute;

my %articles;
while (my $art = $get_art_list->fetchrow_hashref) {
    $articles{$art->{'title'}} = $articles->{$art->{'id'};}

my @ordered = map {$articles{$_}} sort map
{/^((a)|(an)|(the))\s+(.*)/?$3:$_} keys %articles;

# you now have @ordered, which has key ids in order the way you want them.

Dodger
----- Original Message -----
From: "Bin Zhang" <bzhang@hawaii.edu>
To: "Msql-Mysql-Modules" <msql-mysql-modules@lists.mysql.com>; "Mysql"
<mysql@lists.mysql.com>
Sent: Wednesday, July 25, 2001 5:20 AM
Subject: Sorting w/ leading articles ignored


> Can this be done?  What I want is to generate a list of journal sorted by
> the titles, ignoring the leading articles (the, a, an, etc.).  If there is
> no SQL statement for this, How could I do this w/ DBI or PHP?  I am using
> mysql 3.23.40 on  Solaris 7. Thanks for any advise.
>
> Bin
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail
msql-mysql-modules-thread1334@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
>
>


["msql-mysql-modules_1336.ezm" (message/rfc822)]

Message-ID: <018101c11529$c97e61f0$2b0aa8c0@mephisto>
Reply-To: "Stefan Hinz" <hinz@iConnect.de>
From: "Stefan Hinz" <hinz@js-webshop.com>
To: "Bin Zhang" <bzhang@hawaii.edu>,
	"Msql-Mysql-Modules" <msql-mysql-modules@lists.mysql.com>,
	"Mysql" <mysql@lists.mysql.com>
Subject: Re: Sorting w/ leading articles ignored
Date: Wed, 25 Jul 2001 18:28:11 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Dear Zhang,

check for the "regular expression" section in the MySQL manual. You can
filter out any patterns you want with RegExp :)

Regards,

--
  Stefan Hinz
  Geschäftsführer / CEO iConnect e-commerce solutions GmbH
  #  www.js-webShop.com www.iConnect.de
  #  Gustav-Meyer-Allee 25, 13355 Berlin
  #  Tel: +49-30-46307-382  Fax: +49-30-46307-388

----- Original Message -----
From: "Bin Zhang" <bzhang@hawaii.edu>
To: "Msql-Mysql-Modules" <msql-mysql-modules@lists.mysql.com>; "Mysql"
<mysql@lists.mysql.com>
Sent: Wednesday, July 25, 2001 11:20 AM
Subject: Sorting w/ leading articles ignored


> Can this be done?  What I want is to generate a list of journal sorted
by
> the titles, ignoring the leading articles (the, a, an, etc.).  If
there is
> no SQL statement for this, How could I do this w/ DBI or PHP?  I am
using
> mysql 3.23.40 on  Solaris 7. Thanks for any advise.
>
> Bin
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread80562@lists.mysql.com>
> To unsubscribe, e-mail
<mysql-unsubscribe-hinz=js-webshop.com@lists.mysql.com>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


["msql-mysql-modules_1337.ezm" (message/rfc822)]

Date: Wed, 25 Jul 2001 17:34:07 -0400 (EDT)
From: Christopher Hicks <chicks@chicks.net>
To: Dodger <sean@aquest.com>
cc: <msql-mysql-modules@lists.mysql.com>
Subject: Re: quoting
Message-ID: <Pine.LNX.4.33.0107251731340.19080-100000@yakko.chicks.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Tue, 24 Jul 2001, Dodger wrote:
> > (btw, I don't want to use placeholders)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^This is silly.
> Do you have a good reason why not?

(A) When you don't know exactly which fields are going to be available for
the insert/update.

(B) Preparing is usually more trouble than it's worth since it doesn't
provide any performance improvement for MySQL anyway.  For DB2 et al where
the SQL parsing overhead is ridiculous it's a necessity.

-- 
</chris>

Given enough time and money, eventually Microsoft will re-invent UNIX.
                      -- From a Slashdot.org post


["msql-mysql-modules_1338.ezm" (message/rfc822)]

Message-ID: <3B5FBBCF.8060607@ispsoft.de>
Date: Thu, 26 Jul 2001 08:42:23 +0200
From: Jochen Wiedmann <joe@ispsoft.de>
MIME-Version: 1.0
To: Christopher Hicks <chicks@chicks.net>
CC: Dodger <sean@aquest.com>, msql-mysql-modules@lists.mysql.com
Subject: Re: quoting
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Christopher Hicks wrote:

> On Tue, 24 Jul 2001, Dodger wrote:
> 
>>>(btw, I don't want to use placeholders)
>>>
>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^This is silly.
>>Do you have a good reason why not?
>>
> 
> (A) When you don't know exactly which fields are going to be available for
> the insert/update.


I do not understand this argument. In particular for dynamically
generated statements placeholders are very elegant. I typically
create an array @col_names and an array @col_values:

   my $stmt = "INSERT INTO table (" .
     join(", ", @col_names) . ") VALUES (" .
     join(", ", map{ "?" } @col_values) . ")";
   $sth = $dbh->do($stmt, undef, @col_values);

Try to make this shorter, cleaner, more failsafe or faster
with quote!


> (B) Preparing is usually more trouble than it's worth since it doesn't
> provide any performance improvement for MySQL anyway.  For DB2 et al where
> the SQL parsing overhead is ridiculous it's a necessity.


I never had trouble with placeholders, but many trouble with

not using it. Besides, even with MySQL the performance is
better with placeholders than without.




["msql-mysql-modules_1342.ezm" (message/rfc822)]

Date: Thu, 26 Jul 2001 21:24:43 -0300
Message-Id: <200107270024.f6R0Oh322781@stratus.swi.com.br>
Cc: <msql-mysql-modules@lists.mysql.com>, Dodger <sean@aquest.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
From: Raul Dias <chaos@swi.com.br>
To: Jochen Wiedmann <joe@ispsoft.de>, Christopher Hicks <chicks@chicks.net>
Subject: Re: quoting


>>>>(btw, I don't want to use placeholders)
>>>>
>>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^This is silly.
>>>Do you have a good reason why not?
>>>
>> 
>> (A) When you don't know exactly which fields are going to be available for
>> the insert/update.
>
>
>I do not understand this argument. In particular for dynamically
>generated statements placeholders are very elegant. I typically
>create an array @col_names and an array @col_values:
>
>   my $stmt = "INSERT INTO table (" .
>     join(", ", @col_names) . ") VALUES (" .
>     join(", ", map{ "?" } @col_values) . ")";
>   $sth = $dbh->do($stmt, undef, @col_values);
>
>Try to make this shorter, cleaner, more failsafe or faster
>with quote!
>

I liked the challenge 8) 

my $stmt = "INSERT INTO table SET " . 
  join (", ", 
    map{ 
      "$col_names[$_]=" . $dbh->quote($col_values[$_]) 
    } (0..$#col_names)
  );
my $sth = $dbh->do($stmt);

Regards,

Raul Dias

["msql-mysql-modules_1343.ezm" (message/rfc822)]

Message-ID: <01c101c11635$d888b440$0a01a8c0@bens1.pa.home.com>
Reply-To: "Dodger" <sean@aquest.com>
From: "Dodger" <sean@aquest.com>
To: "Raul Dias" <chaos@swi.com.br>,
	"Jochen Wiedmann" <joe@ispsoft.de>,
	"Christopher Hicks" <chicks@chicks.net>
Cc: <msql-mysql-modules@lists.mysql.com>
Subject: Re: quoting
Date: Thu, 26 Jul 2001 20:48:26 -0400
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

----- Original Message -----
From: "Raul Dias" <chaos@swi.com.br>
To: "Jochen Wiedmann" <joe@ispsoft.de>; "Christopher Hicks"
<chicks@chicks.net>
Cc: <msql-mysql-modules@lists.mysql.com>; "Dodger" <sean@aquest.com>
Sent: Thursday, July 26, 2001 8:24 PM
Subject: Re: quoting


> >I do not understand this argument. In particular for dynamically
> >generated statements placeholders are very elegant. I typically
> >create an array @col_names and an array @col_values:

> >   my $stmt = "INSERT INTO table (" .
> >     join(", ", @col_names) . ") VALUES (" .
> >     join(", ", map{ "?" } @col_values) . ")";
> >   $sth = $dbh->do($stmt, undef, @col_values);

> >Try to make this shorter, cleaner, more failsafe or faster
> >with quote!

> I liked the challenge 8)

> my $stmt = "INSERT INTO table SET " .
>   join (", ",
>     map{
>       "$col_names[$_]=" . $dbh->quote($col_values[$_])
>     } (0..$#col_names)
>   );
> my $sth = $dbh->do($stmt);

I prefer placeholders.

$dbh->do(sprintf(<<"eosql", join(', ' keys %data), join(', ',('?') x scalar
keys %data)), undef, values %data);
INSERT INTO table (%s) VALUES (%s)
eosql

But I can do it without as easily:

$dbh->do(sprintf(<<"eosql", join(', ' keys %data), join(', ', map
{$dbh->quote($_)} values %data)));
INSERT INTO table (%s) VALUES (%s)
eosql

I dunno about faster, failsafe, but that's pretty damned short and clean!

(BTW, to match above data 'structure', precede with:)

my %data = map {$col_names[$_], $col_values[$_]} 0..$#col_names;

(or)

my %data;
$data{$col_names[$_]} = $data{$col_values[$_]} for 0..$#col_names;

--
Dodger
www.dodger.org


["msql-mysql-modules_1344.ezm" (message/rfc822)]

Message-ID: <3B6171CE.10608@ispsoft.de>
Date: Fri, 27 Jul 2001 15:51:10 +0200
From: Jochen Wiedmann <joe@ispsoft.de>
MIME-Version: 1.0
To: Raul Dias <chaos@swi.com.br>
CC: Christopher Hicks <chicks@chicks.net>,
	msql-mysql-modules@lists.mysql.com, Dodger <sean@aquest.com>
Subject: Re: quoting
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Raul Dias wrote:

> I liked the challenge 8) 
> 
> my $stmt = "INSERT INTO table SET " . 
>   join (", ", 
>     map{ 
>       "$col_names[$_]=" . $dbh->quote($col_values[$_]) 
>     } (0..$#col_names)
>   );
> my $sth = $dbh->do($stmt);


That works, if all arguments are strings. It doesn't
for mixed types. (It probably does for MySQL, but not
for other databases.)



["msql-mysql-modules_1339.ezm" (message/rfc822)]

Message-ID: <001c01c115b2$a3874dc0$cf01a8c0@darkman>
From: "Rajeev Rumale" <rajeev@myangel.com>
To: "Jochen Wiedmann" <joe@ispsoft.de>, "Robert Goff" <goff@aisling.cc>
Cc: "Raul Dias" <chaos@swi.com.br>, <msql-mysql-modules@lists.mysql.com>
Subject: connection pool via connect_cached
Date: Thu, 26 Jul 2001 17:08:52 +0800
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi,

Refering to your answer to the posting.
Can you put some more light on "connection pool via connect_cached".

With Regards


Rajeev Rumale

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rajeev Rumale
MyAngel.Net Pte Ltd.,                                            Phone  :
(65)8831530 (office)
#04-01, 180 B, The Bencoolen,                               Email  :
rajeev@myangel.com
Bencoolen Street, Singapore - 189648                     ICQ    : 121001541
Website : www.myangel.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


----- Original Message -----
From: "Jochen Wiedmann" <joe@ispsoft.de>
To: "Robert Goff" <goff@aisling.cc>
Cc: "Raul Dias" <chaos@swi.com.br>; <msql-mysql-modules@lists.mysql.com>
Sent: Monday, July 23, 2001 5:31 PM
Subject: Re: multiples statement handlers ($sth) together


> Robert Goff wrote:
>
> >>Having different $dbhs for each thread means that I would need
> >>to connect to the database in each thread, right? Can't I have
> >>different $dbh's sharing the same connection?
> >>
> >
> > A $dbh, the return value of the DBI->connect() method, is mapped
one-to-one
> > with a database connection.  As far as I know, there is no way to have
two
> > separate $dbh objects without two separate database connections.
>
>
> Thats correct. Using one dbh per thread is definitely recommended.
> With MySQL it is no problem to connect/disconnect. Besides, you
> can always use a connection pool via connect_cached.
>
>
> Bye,
>
> Jochen
>
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail
msql-mysql-modules-thread1328@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
>
>


["msql-mysql-modules_1340.ezm" (message/rfc822)]

Message-ID: <3B5FDEF2.8070802@ispsoft.de>
Date: Thu, 26 Jul 2001 11:12:18 +0200
From: Jochen Wiedmann <joe@ispsoft.de>
MIME-Version: 1.0
To: Rajeev Rumale <rajeev@myangel.com>
CC: Robert Goff <goff@aisling.cc>, Raul Dias <chaos@swi.com.br>,
	msql-mysql-modules@lists.mysql.com
Subject: Re: connection pool via connect_cached
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Rajeev Rumale wrote:

> Hi,
> 
> Refering to your answer to the posting.
> Can you put some more light on "connection pool via connect_cached".


perldoc DBI



["msql-mysql-modules_1341.ezm" (message/rfc822)]

From: "Maxwell Krohn" <krohn@staff.thespark.com>
To: <msql-mysql-modules@lists.mysql.com>
Subject: Bug in Makefile.PL
Date: Thu, 26 Jul 2001 09:47:32 -0400
Message-ID: <NDBBIOILBKFAMNDAPNMDKECNDHAA.krohn@staff.thespark.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi All,

I've found a bug in Makefile.PL that causes the test suite to fail when run
on a remote database.  For instance, if you were to specify
db.yourdomain.com as the remote database server, the DSN value output by
perl Makefile.PL is still set for the localhost.

I have what seems to be the most recent version of the package,
Msql-Mysql-modules-1.2216.

This line should be added after line 113 of Makefile.PL:

$test_dsn .= ";host=$test_host";

And the problem seems to be solved.

Max Krohn



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic