Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: variables inside SQL statements

by indigo (Scribe)
on Oct 11, 2000 at 02:24 UTC ( #36141=note: print w/replies, xml ) Need Help??


in reply to variables inside SQL statements

Note - Interpolating variables into SQL is bad. Instead, use 'bind' variables, like so:
my $sql = 'INSERT INTO table ( path ) VALUES (:1)'; # Compile sql my $sth = $dbh->prepare($sql) or die $dbh->errstr; # Bind path to :1 $sth->execute('/path/to/this') or die $dbh->errstr;

Replies are listed 'Best First'.
RE: Answer: variables inside SQL statements
by merlyn (Sage) on Oct 11, 2000 at 03:44 UTC
      You mean there are databases other than mySQL and Oracle? I don't understand. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://36141]
help
Chatterbox?
[erix]: I guess I'll stare it down in the end but I'm already staring for a while... :)
[erix]: btw, I had a typo in there, so reload (if anyone is looking)

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2018-01-19 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (216 votes). Check out past polls.

    Notices?