Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: SQL and Placeholders

by pfaut (Priest)
on Mar 15, 2003 at 23:09 UTC ( #243364=note: print w/replies, xml ) Need Help??

in reply to SQL and Placeholders

Since the value is all numeric, DBI/DBD might be attempting to treat it as a number instead of a string. This could be a problem since it's too large for an int unless you have a 64-bit perl. You might try explicitly binding as a string.

use DBI qw(:sql_types); my $query="SELECT * FROM $table WHERE (ukey = ?)"; my $sth=$dbh->prepare($query); $sth->bind_param(1, $ukey, SQL_VARCHAR); $sth->execute();

BTW, since you're not checking the returns, I hope you have RaiseError set.

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Re: Re: SQL and Placeholders
by digger (Friar) on Mar 16, 2003 at 02:16 UTC
    I am setting RaiseError to 1 when I create the connection. When I first created this code, I was checking after every action. Thank $deity for the documentation. I am going to save many keystrokes with RaiseError.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2021-06-25 13:14 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (136 votes). Check out past polls.