From: David Kamholz Date: Fri, 3 Feb 2006 15:03:20 +0000 (+0000) Subject: put txn_* functions in Schema and call those from DB X-Git-Tag: v0.05005~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08b515f102fb7e5780512ca541f539bc75e662be;p=dbsrgits%2FDBIx-Class.git put txn_* functions in Schema and call those from DB --- diff --git a/lib/DBIx/Class/DB.pm b/lib/DBIx/Class/DB.pm index c97a708..0fdb184 100644 --- a/lib/DBIx/Class/DB.pm +++ b/lib/DBIx/Class/DB.pm @@ -104,7 +104,7 @@ Begins a transaction (does nothing if AutoCommit is off). =cut -sub txn_begin { $_[0]->storage->txn_begin } +sub txn_begin { $_[0]->schema_instance->txn_begin } =head2 txn_commit @@ -112,7 +112,7 @@ Commits the current transaction. =cut -sub txn_commit { $_[0]->storage->txn_commit } +sub txn_commit { $_[0]->schema_instance->txn_commit } =head2 txn_rollback @@ -120,7 +120,7 @@ Rolls back the current transaction. =cut -sub txn_rollback { $_[0]->storage->txn_rollback } +sub txn_rollback { $_[0]->schema_instance->txn_rollback } { my $warn; diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index b3f8330..d492dc1 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -330,7 +330,31 @@ Conveneience method, equivalent to $schema->clone->connection(@info) =cut -sub connect { shift->clone->connection(@_) }; +sub connect { shift->clone->connection(@_) } + +=head2 txn_begin + +Begins a transaction (does nothing if AutoCommit is off). + +=cut + +sub txn_begin { shift->storage->txn_begin } + +=head2 txn_commit + +Commits the current transaction. + +=cut + +sub txn_commit { shift->storage->txn_commit } + +=head2 txn_rollback + +Rolls back the current transaction. + +=cut + +sub txn_rollback { shift->storage->txn_rollback } =head2 clone