X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F93autocast.t;h=49c1f5710598f302df5fdd1138dcd9cd33c007d8;hb=wip%2Fwhere_relattr_tests;hp=95d2b9210f1f128d0dd7b57dfa96dbe4dfe25fe1;hpb=5e782048be95b2349b555179fdfae0bcf1e8fc0e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/93autocast.t b/t/93autocast.t index 95d2b92..49c1f57 100644 --- a/t/93autocast.t +++ b/t/93autocast.t @@ -4,8 +4,6 @@ use warnings; use Test::More; use lib qw(t/lib); use DBICTest; -use DBIC::SqlMakerTest; -use DBIC::DebugObj; { # Fake storage driver for sqlite with autocast package DBICTest::SQLite::AutoCast; @@ -37,22 +35,18 @@ my $rs = $schema->resultset ('CD')->search ({ 'me.single_track' => \[ '= ?', [ single_track => 1 ] ], }, { join => 'tracks' }); -my ($sql, @bind); -my $debugobj = DBIC::DebugObj->new (\$sql, \@bind); -my $storage = $schema->storage; -my ($orig_debug, $orig_debugobj) = ($storage->debug, $storage->debugobj); -$storage->debugobj ($debugobj); -$storage->debug (1); - -# the quoting is a debugobj thing, not dbic-internals -my $bind = [ map { "'$_'" } qw/ - 5 1 2009 4 -/]; +my @bind = ( + [ { dbic_colname => "cdid", sqlt_datatype => "integer" } + => 5 ], + [ { dbic_colname => "single_track", sqlt_datatype => "integer" } + => 1 ], + [ { dbic_colname => "tracks.last_updated_on", sqlt_datatype => "datetime" } + => 2009 ], + [ { dbic_colname => "tracks.position", sqlt_datatype => "int" } + => 4 ], +); -$rs->all; -is_same_sql_bind ( - $sql, - \@bind, +$schema->is_executed_sql_bind( sub { $rs->all }, [[ ' SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me @@ -64,16 +58,12 @@ is_same_sql_bind ( AND tracks.last_updated_on < ? AND tracks.position = ? ', - $bind, - 'expected sql with casting off', -); + @bind, +]], 'expected sql with casting off' ); $schema->storage->auto_cast (1); -$rs->all; -is_same_sql_bind ( - $sql, - \@bind, +$schema->is_executed_sql_bind( sub { $rs->all }, [[ ' SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me @@ -85,11 +75,7 @@ is_same_sql_bind ( AND tracks.last_updated_on < CAST (? AS DateTime) AND tracks.position = ? ', - $bind, - 'expected sql with casting on', -); - -$storage->debugobj ($orig_debugobj); -$storage->debug ($orig_debug); + @bind, +]], 'expected sql with casting on' ); done_testing;