Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Seeking a non-quoted DBI placeholder

by salvadors (Pilgrim)
on Jan 30, 2001 at 21:08 UTC ( #55270=note: print w/replies, xml ) Need Help??


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:

my $find_book = $dbh->prepare(qq{ SELECT title FROM book WHERE isbn = ? });
would be fine when passed
my $isbn = "156884915X"; my $title = $dbh->selectrow_array($find_book, undef, $isbn);
But when passed
my $isbn = 1565922433; 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!

Tony

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://55270]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2018-10-19 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (107 votes). Check out past polls.

    Notices?