[Rt-commit] r4278 - in Jifty-DBI/trunk: . lib/Jifty/DBI

jesse at bestpractical.com jesse at bestpractical.com
Fri Dec 9 01:19:52 EST 2005


Author: jesse
Date: Fri Dec  9 01:19:51 2005
New Revision: 4278

Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
Log:
 r19850 at truegrounds:  jesse | 2005-12-09 01:07:39 -0500
  * Ported fixes from SB to base handle


Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	Fri Dec  9 01:19:51 2005
@@ -678,25 +678,31 @@
 =cut
 
 sub rollback {
-    my $self  = shift;
-    my $force = shift || undef;
+     my $self = shift;
+    my $force = shift;
 
-#unless ($TRANSDEPTH) {Carp::confess("Attempted to rollback a transaction with none in progress")};
-    $TRANSDEPTH--;
-
-    if ($force) {
+   my $dbh = $self->dbh;
+    unless( $dbh ) {
         $TRANSDEPTH = 0;
-        return ( $self->dbh->rollback );
+        return;
     }
+ 
+    #unless ($TRANSDEPTH) {Carp::confess("Attempted to rollback a transaction with none in progress")};
+     if ($force) {
+         $TRANSDEPTH = 0;
+        return($dbh->rollback);
+     }
+ 
+    $TRANSDEPTH-- if ($TRANSDEPTH >= 1);
+     if ($TRANSDEPTH == 0 ) {
+        return($dbh->rollback);
+     } else { #we're inside a transaction
+         return($TRANSDEPTH);
+     }
 
-    if ( $TRANSDEPTH == 0 ) {
-        return ( $self->dbh->rollback );
-    }
-    else {    #we're inside a transaction
-        return ($TRANSDEPTH);
-    }
 }
 
+
 =head2 force_rollback
 
 Force the handle to rollback. Whether or not we're deep in nested transactions
@@ -962,15 +968,17 @@
 =cut
 
 sub distinct_query {
-    my $self         = shift;
+    my $self = shift;
     my $statementref = shift;
+    my $sb = shift;
+ 
+     # Prepend select query for DBs which allow DISTINCT on all column types.
+     $$statementref = "SELECT DISTINCT main.* FROM $$statementref";
 
-    #my $table = shift;
-
-    # Prepend select query for DBs which allow DISTINCT on all column types.
-    $$statementref = "SELECT DISTINCT main.* FROM $$statementref";
-
+    $$statementref .= $sb->_group_clause;
+    $$statementref .= $sb->_order_clause;
 }
+ 
 
 =head2 distinct_count STATEMENTREF 
 


More information about the Rt-commit mailing list