[Bast-commits] r7417 - in DBIx-Class/0.08/branches/autocast: lib/DBIx/Class/Storage/DBI t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sat Aug 29 06:07:19 GMT 2009


Author: ribasushi
Date: 2009-08-29 06:07:18 +0000 (Sat, 29 Aug 2009)
New Revision: 7417

Modified:
   DBIx-Class/0.08/branches/autocast/lib/DBIx/Class/Storage/DBI/AutoCast.pm
   DBIx-Class/0.08/branches/autocast/t/93autocast.t
Log:
Make sure arrays work

Modified: DBIx-Class/0.08/branches/autocast/lib/DBIx/Class/Storage/DBI/AutoCast.pm
===================================================================
--- DBIx-Class/0.08/branches/autocast/lib/DBIx/Class/Storage/DBI/AutoCast.pm	2009-08-29 05:42:29 UTC (rev 7416)
+++ DBIx-Class/0.08/branches/autocast/lib/DBIx/Class/Storage/DBI/AutoCast.pm	2009-08-29 06:07:18 UTC (rev 7417)
@@ -48,7 +48,7 @@
       my $col = $bound->[0];
       my $type = $self->_map_data_type($col_info->{$col}{data_type});
 
-      foreach my $data (@{$bound}[1..$#$bound]) {   # <--- this will multiply the amount of ?'s no...?
+      foreach my $data (@{$bound}[1..$#$bound]) {
         $new_sql .= shift(@sql_part) .
           ($type ? "CAST(? AS $type)" : '?');
       }

Modified: DBIx-Class/0.08/branches/autocast/t/93autocast.t
===================================================================
--- DBIx-Class/0.08/branches/autocast/t/93autocast.t	2009-08-29 05:42:29 UTC (rev 7416)
+++ DBIx-Class/0.08/branches/autocast/t/93autocast.t	2009-08-29 06:07:18 UTC (rev 7417)
@@ -33,9 +33,15 @@
   'tracks.last_updated_at' => { '!=', undef },
   'tracks.last_updated_on' => { '<', 2009 },
   'tracks.position' => 4,
+  'tracks.single_track' => \[ '= ?', [ single_track => [1, 2, 3 ] ] ],
 }, { join => 'tracks' });
 
-my $bind = [ [ cdid => 5 ], [ 'tracks.last_updated_on' => 2009 ], [ 'tracks.position' => 4 ] ];
+my $bind = [
+  [ cdid => 5 ],
+  [ 'tracks.last_updated_on' => 2009 ],
+  [ 'tracks.position' => 4 ],
+  [ 'single_track' => [ 1, 2, 3] ],
+];
 
 is_same_sql_bind (
   $rs->as_query,
@@ -48,6 +54,7 @@
       AND tracks.last_updated_at IS NOT NULL
       AND tracks.last_updated_on < ?
       AND tracks.position = ?
+      AND tracks.single_track = ?
   )',
   $bind,
   'expected sql with casting off',
@@ -66,6 +73,7 @@
       AND tracks.last_updated_at IS NOT NULL
       AND tracks.last_updated_on < CAST (? AS yyy)
       AND tracks.position = ?
+      AND tracks.single_track = CAST(? AS INT)
   )',
   $bind,
   'expected sql with casting on',




More information about the Bast-commits mailing list