[Bps-public-commit] dbix-searchbuilder branch, cud-from-select, updated. 1.59-10-g18e008c

Ruslan Zakirov ruz at bestpractical.com
Thu Apr 7 15:57:42 EDT 2011


The branch, cud-from-select has been updated
       via  18e008c206899d2092f5a73b4e0337304f02ffda (commit)
      from  bc9724006933fbc870dacefa9d37d6fd9a24b4e5 (commit)

Summary of changes:
 lib/DBIx/SearchBuilder/Handle/mysql.pm |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 18e008c206899d2092f5a73b4e0337304f02ffda
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Apr 7 23:57:12 2011 +0400

    return number of rows we changed

diff --git a/lib/DBIx/SearchBuilder/Handle/mysql.pm b/lib/DBIx/SearchBuilder/Handle/mysql.pm
index f619139..e4eb015 100755
--- a/lib/DBIx/SearchBuilder/Handle/mysql.pm
+++ b/lib/DBIx/SearchBuilder/Handle/mysql.pm
@@ -92,9 +92,6 @@ sub DeleteFromSelect {
         $table, $query, @query_binds
     ) unless $query =~ /\b\Q$table\E\b/i;
 
-    my $sth = $self->SimpleQuery( $query, @query_binds );
-    return $sth unless $sth;
-
     return $self->SimpleMassChangeFromSelect(
         "DELETE FROM $table WHERE id IN ", [],
         $query, @query_binds
@@ -122,14 +119,14 @@ sub SimpleMassChangeFromSelect {
         my $sth = $self->SimpleQuery( $q, @$update_binds, splice @ids );
         return $sth unless $sth;
 
-        $res += @ids;
+        $res += $sth->rows;
     }
     if ( @ids ) {
         my $q = $update_query .'('. join( ',', ('?')x at ids ) .')';
         my $sth = $self->SimpleQuery( $q, @$update_binds, splice @ids );
         return $sth unless $sth;
 
-        $res += @ids;
+        $res += $sth->rows;
     }
     return $res == 0? '0E0': $res;
 }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list