TransactionManager - transaction handling for database.
require_once 'TransactionManager.php';
$pdo = new PDO('sqlite::memory:');
$tm = TransactionManager($pdo);
$tm->txn_begin( );
$pdo->query("INSERT INTO foo (id, var) VALUES (1, 'baz')";
$tm->txn_commit( );
require_once 'TransactionManager.php';
$pdo = new PDO('sqlite::memory:');
$tm = TransactionManager($pdo);
my $txn = $tm->txn_scope( );
$pdo->query("INSERT INTO foo (id, var) VALUES (1, 'baz')";
$txn->commit( );
require_once 'TransactionManager.php';
$pdo = new PDO('sqlite::memory:');
$tm = TransactionManager($pdo);
$txn1 = $tm->txn_scope( );
$pdo->query("INSERT INTO foo (id, var) VALUES (1, 'baz')";
$txn2 = $tm->txn_scope( );
$pdo->query("INSERT INTO foo (id, var) VALUES (2, 'bab')";
$txn2->commit( );
$txn3 = $tm->txn_scope( );
$pdo->query("INSERT INTO foo (id, var) VALUES (3, 'bee')";
$txn3->commit( );
$txn1->commit( );
TransactionManager is a simple transaction manager. based on DBIx::TransactionManager
get TransactionManager's instance object. $pdo parameter must be required.
get TransactionManagerScopeGuard's instance object.
Start the transaction.
Rollback the transaction.
Commit the transaction.
are you in transaction?
Commit the transaction.
Rollback the transaction.