Commit 2ee689c3 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Added transaction wrappers

parent e635f603
......@@ -1191,6 +1191,31 @@ function db_array_to_ph($array) {
return array_pad(array(), count($array), '?');
}
/**
* This function starts a smart transaction
*
*/
function db_begin() {
global $db;
$db->StartTrans();
}
/**
* This function commits a smart transaction
*
* If the transaction has failed for any reason, an exception is thrown.
*
*/
function db_commit() {
global $db;
if ($db->HasFailedTrans()) {
$db->CompleteTrans();
throw new SQLException('Transaction Failed');
}
$db->CompleteTrans();
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment