execute runs the SQL query and returns the number of rows affected. execute is called after a prepare statement and can include data to replace any placeholders in the SQL statement.


$sql1 = qq{SELECT * FROM library}; $sql2 = qq{INSERT INTO library (title, author, price)      VALUES (?, ?, ?)}; $handle1 = $db_handle->prepare($sql1); $handle2 = $db_handle->prepare($sql2); my $rows1 = $handle1->execute; my $rows2 = $handle2->execute("Evil Empires for Dummies", "Bill Gates", 12.95);

These examples show how to call execute alone and also with placeholders. The values in $rows are the number of rows affected by the respective SQL statement.

Perl Database Programming
Perl Database Programming
ISBN: 0764549561
EAN: 2147483647
Year: 2001
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net