Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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;

Comment on Re: variables inside SQL statements
Download Code
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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2015-12-01 09:54 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (798 votes), past polls