[Bps-public-commit] dbix-searchbuilder branch, fix-binds-in-cud-from-select, created. 1.61-5-gcfd255d

Ruslan Zakirov ruz at bestpractical.com
Tue Mar 20 17:14:46 EDT 2012


The branch, fix-binds-in-cud-from-select has been created
        at  cfd255daf2cd75c7a2669d3f690135719bac006b (commit)

- Log -----------------------------------------------------------------
commit 0382ea6f854247e6ff6912ff085f0b447f2c55e3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 21 01:06:16 2012 +0400

    make sure we test bind valus in *FromSelect

diff --git a/t/03cud_from_select.t b/t/03cud_from_select.t
index 3c40857..7f5d21b 100644
--- a/t/03cud_from_select.t
+++ b/t/03cud_from_select.t
@@ -65,7 +65,7 @@ diag "insert into table from two tables" if $ENV{'TEST_VERBOSE'};
 
 {
     my $res = $handle->DeleteFromSelect(
-        'UsersToGroups' => 'SELECT id FROM UsersToGroups WHERE GroupId = 1'
+        'UsersToGroups' => 'SELECT id FROM UsersToGroups WHERE GroupId = ?', 1
     );
     is( $res, 2 );
 
@@ -79,7 +79,8 @@ diag "insert into table from two tables" if $ENV{'TEST_VERBOSE'};
     my $res = $handle->SimpleUpdateFromSelect(
         'UsersToGroups',
         { UserId => 2, GroupId => 2 },
-        'SELECT id FROM UsersToGroups WHERE UserId = 1 AND GroupId = 3'
+        'SELECT id FROM UsersToGroups WHERE UserId = ? AND GroupId = ?',
+        1, 3
     );
     is( $res, 1 );
 

commit cfd255daf2cd75c7a2669d3f690135719bac006b
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 21 01:07:18 2012 +0400

    we were ignoring query binds in SimpleUpdateFromSelect

diff --git a/lib/DBIx/SearchBuilder/Handle.pm b/lib/DBIx/SearchBuilder/Handle.pm
index 8b7075d..550b99a 100755
--- a/lib/DBIx/SearchBuilder/Handle.pm
+++ b/lib/DBIx/SearchBuilder/Handle.pm
@@ -502,7 +502,7 @@ sub SimpleUpdateFromSelect {
     my $full_query = "UPDATE $table SET ";
     $full_query .= join ', ', map "$_ = ?", @columns;
     $full_query .= ' WHERE id IN ('. $query .')';
-    my $sth = $self->SimpleQuery( $full_query, @binds );
+    my $sth = $self->SimpleQuery( $full_query, @binds, @query_binds );
     return $sth unless $sth;
 
     my $rows = $sth->rows;

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



More information about the Bps-public-commit mailing list