Perl and SQL

David A. Sinck plug-devel@lists.PLUG.phoenix.az.us
Tue Mar 25 13:05:03 2003


\_ SMTP quoth Shay Harding on 3/25/2003 11:21 as having spake thusly:
\_
\_ Actually there are a few things to look out for
\_ here...
\_ 
\_ 1. Just use: $text = $dbh->quote($text); to quote
\_ anything MySQL doesn't like.

Also see the 'placeholder and bind parameters' in the DBI man page.

\_ 3. With the DBI MySQL driver, I don't think there is a
\_ choice whether to query for the entire result set...
\_ pretty sure it calls the underlying C API function
\_ "mysql_store_result" by default in all instances,
\_ rather than the "mysql_use_result".

Try this:
 
    $sth = $dbh->prepare(qq|...|, { "mysql_use_result" => 1 });

David