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)" : '?');
}
'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,
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',
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',