10 messages in com.mysql.lists.perlRe: quoting
FromSent OnAttachments
Raul Dias23 Jul 2001 16:14 
Dodger23 Jul 2001 21:16 
Christopher Hicks25 Jul 2001 14:33 
Jochen Wiedmann25 Jul 2001 23:42 
Raul Dias26 Jul 2001 17:24 
Dodger26 Jul 2001 17:48 
Jochen Wiedmann27 Jul 2001 06:50 
Raul Dias27 Jul 2001 10:02 
Jochen Wiedmann27 Jul 2001 10:08 
Dodger27 Jul 2001 10:24 
Subject:Re: quoting
From:Jochen Wiedmann (jo@ispsoft.de)
Date:07/25/2001 11:42:01 PM
List:com.mysql.lists.perl

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.