|
NAMEDBIx::TransactionManager - Transaction handling for database. SYNOPSISRAII style transaction management: use DBI;
use DBIx::TransactionManager;
my $dbh = DBI->connect('dbi:SQLite:');
my $tm = DBIx::TransactionManager->new($dbh);
# create transaction object
my $txn = $tm->txn_scope;
# execute query
$dbh->do("insert into foo (id, var) values (1,'baz')");
# And you can do multiple database operations here
# and commit it.
$txn->commit;
Nested transaction usage: use DBI;
use DBIx::TransactionManager;
my $dbh = DBI->connect('dbi:SQLite:');
my $tm = DBIx::TransactionManager->new($dbh);
{
my $txn = $tm->txn_scope;
$dbh->do("insert into foo (id, var) values (1,'baz')");
{
my $txn2 = $tm->txn_scope;
$dbh->do("insert into foo (id, var) values (2,'bab')");
$txn2->commit;
}
{
my $txn3 = $tm->txn_scope;
$dbh->do("insert into foo (id, var) values (3,'bee')");
$txn3->commit;
}
$txn->commit;
}
DESCRIPTIONDBIx::TransactionManager is a simple transaction manager. like DBIx::Class::Storage::TxnScopeGuard. This module provides two futures. If you are writing of DBIx::* or O/R Mapper, see DBIx::TransactionManager::Developers. METHODS
DBIx::TransactionManager::ScopeGuard's METHODS
DBIx::TransactionManager and other transaction managersYou cannot use other transaction manager and DBIx::TransactionManager at once. If you are using O/R mapper, you should use that's transaction management feature. AUTHORAtsushi Kobayashi <nekokak _at_ gmail _dot_ com> SEE ALSODBIx::Class::Storage::TxnScopeGuard DBIx::Skinny::Transaction LICENSEThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|