X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fprefetch%2Fgrouped.t;h=27d3865f05dc40ab35716b4a5b1e5354573bd3dd;hb=908aa1bb761ec1da5c061fe9f687598e3f1934bc;hp=c8c3e87b24bf67644a95355ebfc9148fc1f3b090;hpb=0e773352a9c6c034dfb2526b8d68bf6ac1e2323b;p=dbsrgits%2FDBIx-Class.git diff --git a/t/prefetch/grouped.t b/t/prefetch/grouped.t index c8c3e87..27d3865 100644 --- a/t/prefetch/grouped.t +++ b/t/prefetch/grouped.t @@ -2,11 +2,13 @@ use strict; use warnings; use Test::More; -use Test::Exception; use lib qw(t/lib); use DBICTest; use DBIC::SqlMakerTest; +use DBIx::Class::SQLMaker::LimitDialects; + +my $ROWS = DBIx::Class::SQLMaker::LimitDialects->__rows_bindtype; my $schema = DBICTest->init_schema(); my $sdebug = $schema->storage->debug; @@ -152,10 +154,10 @@ for ($cd_rs->all) { FROM cd me WHERE ( me.cdid IS NOT NULL ) GROUP BY me.cdid - LIMIT 2 + LIMIT ? ) me )', - [], + [[$ROWS => 2]], 'count() query generated expected SQL', ); @@ -172,14 +174,14 @@ for ($cd_rs->all) { WHERE ( me.cdid IS NOT NULL ) GROUP BY me.cdid ORDER BY track_count DESC, maxtr ASC - LIMIT 2 + LIMIT ? ) me LEFT JOIN track tracks ON tracks.cd = me.cdid LEFT JOIN liner_notes liner_notes ON liner_notes.liner_id = me.cdid WHERE ( me.cdid IS NOT NULL ) - ORDER BY track_count DESC, maxtr ASC, tracks.cd + ORDER BY track_count DESC, maxtr ASC )', - [], + [[$ROWS => 2]], 'next() query generated expected SQL', ); @@ -225,7 +227,7 @@ for ($cd_rs->all) { ORDER BY cdid ) me LEFT JOIN tags tags ON tags.cd = me.cdid - ORDER BY cdid, tags.cd, tags.tag + ORDER BY cdid )', [], 'Prefetch + distinct resulted in correct group_by', @@ -348,12 +350,12 @@ for ($cd_rs->all) { FROM (SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track, COUNT( tags.tag ) AS test_count FROM cd me LEFT JOIN tags tags ON tags.cd = me.cdid GROUP BY me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track, tags.tag - ORDER BY tags.tag ASC LIMIT 1) + ORDER BY tags.tag ASC LIMIT ?) me LEFT JOIN tags tags ON tags.cd = me.cdid - ORDER BY tags.tag ASC, tags.cd, tags.tag + ORDER BY tags.tag ASC ) - }, []); + }, [[$ROWS => 1]]); } done_testing;