forked from SkyPHP/skyphp
-
Notifications
You must be signed in to change notification settings - Fork 1
AQL Transactions
stanistan edited this page Jun 2, 2011
·
1 revision
AQL has wrapper functions for ADODB's transaction methods.
If any AQL methods are called while in a transaction, errors will be suppressed so that the transaction can be rolled back. Otherwise, an E_USER_ERROR
is triggered.
- aql::start_transaction()
- aql::complete_transaction()
- aql::fail_transaction()
- aql::in_transaction()
- aql::transaction_failed()
Usage: Call aql::start_transaction()
to start a transaction.
Usage: Call aql::complete_transaction()
to finish a transaction, or rollback if the transaction failed.
Usage: Call aql::fail_transaction()
when in a transaction to trigger failure. aql::transaction_failed() will return true
.
Usage: aql::in_transaction()
will return true or false based on if the query is being executed in a transaction.
Usage: Will return true if a query failed inside the transaction.
aql::start_transaction();
aql::fail_transaction(); // trigger failure
...
aql::insert(...);
aql::update(...);
...
$failed = aql::transaction_failed();
aql::complete_transaction();
if ($failed) {
echo 'Transaction Failed';
}