[Rt-commit] r4200 - DBIx-SearchBuilder/trunk/SearchBuilder

ruz at bestpractical.com ruz at bestpractical.com
Thu Dec 1 05:45:18 EST 2005


Author: ruz
Date: Thu Dec  1 05:45:17 2005
New Revision: 4200

Modified:
   DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm
Log:
* exit silently from rollback if we have no connection yet

Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm	(original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm	Thu Dec  1 05:45:17 2005
@@ -700,17 +700,23 @@
 
 sub Rollback {
     my $self = shift;
-    my $force = shift || undef;
-    #unless ($TRANSDEPTH) {Carp::confess("Attempted to rollback a transaction with none in progress")};
-    $TRANSDEPTH-- if ($TRANSDEPTH >= 1);
+    my $force = shift;
 
+    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($self->dbh->rollback);
+        return($dbh->rollback);
     }
 
+    $TRANSDEPTH-- if ($TRANSDEPTH >= 1);
     if ($TRANSDEPTH == 0 ) {
-       return($self->dbh->rollback);
+        return($dbh->rollback);
     } else { #we're inside a transaction
         return($TRANSDEPTH);
     }


More information about the Rt-commit mailing list