use DBIx::Class::ClassResolver::PassThrough;
use DBI;
+*dbi_commit = \&tx_commit;
+*dbi_rollback = \&tx_rollback;
+
=head1 NAME
DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance
package MyDB::MyTable;
use base qw/MyDB/;
- __PACKAGE__->load_components('Core');
+ __PACKAGE__->load_components('Core'); # just load this in MyDB if it will always be there
...
$class->storage($storage);
}
-=head2 dbi_commit
+=head2 tx_begin
+
+Begins a transaction (does nothing if AutoCommit is off).
+
+=cut
+
+sub tx_begin { $_[0]->storage->tx_begin }
+
+=head2 tx_commit
-Issues a commit against the current dbh.
+Commits the current transaction.
=cut
-sub dbi_commit { $_[0]->storage->commit; }
+sub tx_commit { $_[0]->storage->tx_commit }
-=head2 dbi_rollback
+=head2 tx_rollback
-Issues a rollback against the current dbh.
+Rolls back the current transaction.
=cut
-sub dbi_rollback { $_[0]->storage->rollback; }
+sub tx_rollback { $_[0]->storage->tx_rollback }
sub resolve_class { return shift->class_resolver->class(@_); }