[Bast-commits] r5145 - in SQL-Abstract/1.x/branches/1.50_RC: . lib/SQL t

norbi at dev.catalyst.perl.org norbi at dev.catalyst.perl.org
Sun Nov 16 21:20:50 GMT 2008


Author: norbi
Date: 2008-11-16 21:20:49 +0000 (Sun, 16 Nov 2008)
New Revision: 5145

Modified:
   SQL-Abstract/1.x/branches/1.50_RC/
   SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm
   SQL-Abstract/1.x/branches/1.50_RC/t/01generate.t
Log:
 r5170 at vger:  mendel | 2008-11-16 21:36:10 +0100
  * Added test cases for passing arrayref bind values to insert() and update() when the 'array_datatypes' constructor parameter is set to true.
  * Fixed a bug in insert() when 'array_datatypes' is set to true and an arrayref is passed.



Property changes on: SQL-Abstract/1.x/branches/1.50_RC
___________________________________________________________________
Name: svk:merge
   - 4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/SQL-Abstract/1.x/branches/1.50_RC:5169
   + 4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/SQL-Abstract/1.x/branches/1.50_RC:5170

Modified: SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm	2008-11-16 21:20:44 UTC (rev 5144)
+++ SQL-Abstract/1.x/branches/1.50_RC/lib/SQL/Abstract.pm	2008-11-16 21:20:49 UTC (rev 5145)
@@ -145,6 +145,7 @@
       ARRAYREF => sub { 
         if ($self->{array_datatypes}) { # if array datatype are activated
           push @values, '?';
+          push @all_bind, $v;
         }
         else {                          # else literal SQL with bind
           my ($sql, @bind) = @$v;

Modified: SQL-Abstract/1.x/branches/1.50_RC/t/01generate.t
===================================================================
--- SQL-Abstract/1.x/branches/1.50_RC/t/01generate.t	2008-11-16 21:20:44 UTC (rev 5144)
+++ SQL-Abstract/1.x/branches/1.50_RC/t/01generate.t	2008-11-16 21:20:49 UTC (rev 5145)
@@ -5,7 +5,7 @@
 use Test::More;
 
 use SQL::Abstract::Test import => ['is_same_sql_bind'];
-plan tests => 64;
+plan tests => 72;
 
 use SQL::Abstract;
 
@@ -308,7 +308,43 @@
               stmt   => q{SELECT * FROM test WHERE ( a = to_date(?, 'MM/DD/YY') )},
               stmt_q => q{SELECT * FROM `test` WHERE ( `a` = to_date(?, 'MM/DD/YY') )},
               bind   => ['02/02/02'],
-      }
+      },
+      #33
+      {
+              func   => 'insert',
+              new    => {array_datatypes => 1},
+              args   => ['test', {a => 1, b => [1, 1, 2, 3, 5, 8]}],
+              stmt   => 'INSERT INTO test (a, b) VALUES (?, ?)',
+              stmt_q => 'INSERT INTO `test` (`a`, `b`) VALUES (?, ?)',
+              bind   => [1, [1, 1, 2, 3, 5, 8]],
+      },
+      #34
+      {
+              func   => 'insert',
+              new    => {bindtype => 'columns', array_datatypes => 1},
+              args   => ['test', {a => 1, b => [1, 1, 2, 3, 5, 8]}],
+              stmt   => 'INSERT INTO test (a, b) VALUES (?, ?)',
+              stmt_q => 'INSERT INTO `test` (`a`, `b`) VALUES (?, ?)',
+              bind   => [[a => 1], [b => [1, 1, 2, 3, 5, 8]]],
+      },
+      #35
+      {
+              func   => 'update',
+              new    => {array_datatypes => 1},
+              args   => ['test', {a => 1, b => [1, 1, 2, 3, 5, 8]}],
+              stmt   => 'UPDATE test SET a = ?, b = ?',
+              stmt_q => 'UPDATE `test` SET `a` = ?, `b` = ?',
+              bind   => [1, [1, 1, 2, 3, 5, 8]],
+      },
+      #36
+      {
+              func   => 'update',
+              new    => {bindtype => 'columns', array_datatypes => 1},
+              args   => ['test', {a => 1, b => [1, 1, 2, 3, 5, 8]}],
+              stmt   => 'UPDATE test SET a = ?, b = ?',
+              stmt_q => 'UPDATE `test` SET `a` = ?, `b` = ?',
+              bind   => [[a => 1], [b => [1, 1, 2, 3, 5, 8]]],
+      },
 );
 
 use Data::Dumper;
@@ -333,5 +369,3 @@
 
   is_same_sql_bind($stmt_q, \@bind_q, $_->{stmt_q}, $_->{bind});
 }
-
-




More information about the Bast-commits mailing list