in reply to Seeking a non-quoted DBI placeholder
Anyone know if theres a way to get DBI to not quote a specific placeholder on a statement
Ignoring the flaws that others have already pointed out with your example, it's also worth remembering that DBI will not quote numbers.
This can cause problems when you have a CHAR column to which (sometimes) wish insert numbers. e.g if you had an ISBN column in a book table, the query:
would be fine when passedmy $find_book = $dbh->prepare(qq{ SELECT title FROM book WHERE isbn = ? });
But when passedmy $isbn = "156884915X"; my $title = $dbh->selectrow_array($find_book, undef, $isbn);
it won't quote the ISBN. On some databases (definitely on MySQL) this will have the effect of not using the index on this column, massively slowing down this query - particularly if you have the 1.2 million books in print in this table!my $isbn = 1565922433; my $title = $dbh->selectrow_array($find_book, undef, $isbn);
Tony
|
|---|