Thanks guys!


You don't need to call quote().  When you bind values to placeholders, the
values are quote()d automatically.

So:


$dbh->do(
       'INSERT INTO Stuff (Id,Foo,Bar,Baz) VALUES (NULL,?,?,?)',
        undef,
        $foo, $bar, $baz
     ) or die ....

is the same (IE does the same things as

my $sth = $dbh->prepare('INSERT INTO Stuff (Id,Foo,Bar,Baz) VALUES (NULL,?,?,?)');
$sth->execute($foo, $bar, $baz);



I found do() and quote() in DBI.pm, prepare() in DBD::mysql, but I couldn't find execute() - I wanted to see how it does the quoting exactly (for binary data) -


Anyone know where execute() is?


What differences/benfits/downfalls do I get from doing :


 $dbh->do(
       'INSERT INTO Stuff (Id,Foo,Bar,Baz) VALUES (NULL,?,?,?)',
        undef,
        $foo, $bar, $baz
 ) or die ....

vs.

$foo = $dbh->quote($foo);
$bar = $dbh->quote($bar);
$baz = $dbh->quote($baz);
$dbh->do("INSERT INTO Stuff (Id,Foo,Bar,Baz) VALUES (NULL,$foo,$bar, $baz)") or die ...


besides the obvious have to quote eachone first...

TIA

(last question I swear ;p)

Lee.M - JupiterHost.Net

Reply via email to