[Bast-commits] r3787 -
DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/JDBICompat
matthewt at dev.catalyst.perl.org
matthewt at dev.catalyst.perl.org
Wed Sep 26 03:44:52 GMT 2007
Author: matthewt
Date: 2007-09-26 03:44:51 +0100 (Wed, 26 Sep 2007)
New Revision: 3787
Modified:
DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/JDBICompat/Handle.pm
Log:
converted transaction functions
Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/JDBICompat/Handle.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/JDBICompat/Handle.pm 2007-09-26 02:44:37 UTC (rev 3786)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/JDBICompat/Handle.pm 2007-09-26 02:44:51 UTC (rev 3787)
@@ -636,13 +636,7 @@
=cut
sub begin_transaction {
- my $self = shift;
- $TRANSDEPTH++;
- if ( $TRANSDEPTH > 1 ) {
- return ($TRANSDEPTH);
- } else {
- return ( $self->dbh->begin_work );
- }
+ shift->schema->stroage->txn_begin;
}
=head2 commit
@@ -653,18 +647,7 @@
=cut
sub commit {
- my $self = shift;
- unless ($TRANSDEPTH) {
- Carp::confess(
- "Attempted to commit a transaction with none in progress");
- }
- $TRANSDEPTH--;
-
- if ( $TRANSDEPTH == 0 ) {
- return ( $self->dbh->commit );
- } else { #we're inside a transaction
- return ($TRANSDEPTH);
- }
+ shift->schema->storage->txn_commit;
}
=head2 rollback [FORCE]
@@ -677,28 +660,18 @@
=cut
sub rollback {
+
my $self = shift;
my $force = shift;
+
+ $self->schema->storage->txn_rollback;
- my $dbh = $self->dbh;
- unless ($dbh) {
- $TRANSDEPTH = 0;
- return;
- }
-
-#unless ($TRANSDEPTH) {Carp::confess("Attempted to rollback a transaction with none in progress")};
if ($force) {
- $TRANSDEPTH = 0;
- return ( $dbh->rollback );
+ while ($self->schema->storage->transcation_depth) {
+ $self->schema->storage->txn_rollback;
+ }
}
- $TRANSDEPTH-- if ( $TRANSDEPTH >= 1 );
- if ( $TRANSDEPTH == 0 ) {
- return ( $dbh->rollback );
- } else { #we're inside a transaction
- return ($TRANSDEPTH);
- }
-
}
=head2 force_rollback
@@ -720,7 +693,7 @@
sub transaction_depth {
my $self = shift;
- return ($TRANSDEPTH);
+ return $self->schema->storage->tansaction_depth;
}
=head2 apply_limits STATEMENTREF ROWS_PER_PAGE FIRST_ROW
More information about the Bast-commits
mailing list