X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsearch%2Frelated_strip_prefetch.t;h=5e34fe9801a08fbc5f3b2285215c46ac359cb34c;hb=dc297536f438c5bba86229471b94bd489fe06c12;hp=419fd3220f6d8059f553117e525af038b303ff5f;hpb=4b1b5ea39ae8cc110441ce3dc6b386cba349aff2;p=dbsrgits%2FDBIx-Class.git diff --git a/t/search/related_strip_prefetch.t b/t/search/related_strip_prefetch.t index 419fd32..5e34fe9 100644 --- a/t/search/related_strip_prefetch.t +++ b/t/search/related_strip_prefetch.t @@ -2,16 +2,17 @@ use strict; use warnings; use Test::More; -use Test::Exception; use lib qw(t/lib); -use DBIC::SqlMakerTest; -use DBICTest; +use DBICTest ':DiffSQL'; +use DBIx::Class::SQLMaker::LimitDialects; + +my $ROWS = DBIx::Class::SQLMaker::LimitDialects->__rows_bindtype; my $schema = DBICTest->init_schema(); my $rs = $schema->resultset('CD')->search ( - { 'tracks.id' => { '!=', 666 }}, + { 'tracks.trackid' => { '!=', 666 }}, { join => 'artist', prefetch => 'tracks', rows => 2 } ); @@ -25,9 +26,9 @@ is_same_sql_bind ( SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me JOIN artist artist ON artist.artistid = me.artist - LEFT JOIN track tracks ON tracks.cd = me.cdid - WHERE ( tracks.id != ? ) - LIMIT 2 + LEFT JOIN track tracks ON tracks.cd = me.cdid + WHERE ( tracks.trackid != ? ) + LIMIT ? ) me JOIN artist artist ON artist.artistid = me.artist JOIN tags tags ON tags.cd = me.cdid @@ -35,7 +36,10 @@ is_same_sql_bind ( GROUP BY tags.tagid, tags.cd, tags.tag )', - [ [ 'tracks.id' => 666 ] ], + [ + [ { sqlt_datatype => 'integer', dbic_colname => 'tracks.trackid' } => 666 ], + [ $ROWS => 2 ] + ], 'Prefetch spec successfully stripped on search_related' );