[REVIEW] database->query_batch

Last reviewed: Not reviewed
phpDocumentor

database->query_batch

Executes the current SQL query string as a single transaction.  This function can accept a semi-colon (';') separated list of SQL query strings and execute them in a single call.  If the $transaction_safe parameter is true then all of the individual query strings must complete successfully or else they will all be rolled back.

Syntax

mixed query_batch ( [ boolean $abort_on_error [, boolean $transaction_safe ]] )

$abort_on_error
if true then an error on any of the query strings will cause the function to abort.  If aborted the function will return the database resource for the query that failed.  The error code can be examined by calling database->getErrorNum and the error message can be obtained by calling database->getErrorMsg.
$transaction_safe
if true then the queries will be executed as a single unit of work.  Either they all complete successfully, in which case the function returns true; or they will all be rolled back as soon as any one query fails, in which case the function will return false.

Examples


Please report any errors on this page to the Developer Documentation Forum.


Last Updated ( Monday, 25 December 2006 )