10 messages in com.mysql.lists.perlRe: quoting| From | Sent On | Attachments |
|---|---|---|
| Raul Dias | 23 Jul 2001 16:14 | |
| Dodger | 23 Jul 2001 21:16 | |
| Christopher Hicks | 25 Jul 2001 14:33 | |
| Jochen Wiedmann | 25 Jul 2001 23:42 | |
| Raul Dias | 26 Jul 2001 17:24 | |
| Dodger | 26 Jul 2001 17:48 | |
| Jochen Wiedmann | 27 Jul 2001 06:50 | |
| Raul Dias | 27 Jul 2001 10:02 | |
| Jochen Wiedmann | 27 Jul 2001 10:08 | |
| Dodger | 27 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.




