[Bast-commits] r8101 -
DBIx-Class/0.08/branches/mssql_limit_regression/t/search
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sat Dec 12 23:17:44 GMT 2009
Author: ribasushi
Date: 2009-12-12 23:17:44 +0000 (Sat, 12 Dec 2009)
New Revision: 8101
Modified:
DBIx-Class/0.08/branches/mssql_limit_regression/t/search/related_strip_prefetch.t
Log:
Real test for search_related and prefetch
Modified: DBIx-Class/0.08/branches/mssql_limit_regression/t/search/related_strip_prefetch.t
===================================================================
--- DBIx-Class/0.08/branches/mssql_limit_regression/t/search/related_strip_prefetch.t 2009-12-12 23:07:00 UTC (rev 8100)
+++ DBIx-Class/0.08/branches/mssql_limit_regression/t/search/related_strip_prefetch.t 2009-12-12 23:17:44 UTC (rev 8101)
@@ -12,21 +12,30 @@
my $rs = $schema->resultset('CD')->search (
{ 'tracks.id' => { '!=', 666 }},
- { join => 'artist', prefetch => 'tracks' }
+ { join => 'artist', prefetch => 'tracks', rows => 2 }
);
-my $rel_rs = $rs->search_related ('tags');
+my $rel_rs = $rs->search_related ('tags', { 'tags.tag' => { '!=', undef }}, { distinct => 1});
is_same_sql_bind (
$rel_rs->as_query,
'(
- SELECT tags.tagid, tags.cd, tags.tag
- FROM cd me
+ SELECT tags.tagid, tags.cd, tags.tag
+ FROM (
+ 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
+ ) me
JOIN artist artist ON artist.artistid = me.artist
LEFT JOIN track tracks ON tracks.cd = me.cdid
LEFT JOIN tags tags ON tags.cd = me.cdid
- WHERE ( tracks.id != ? )
+ WHERE ( tags.tag IS NOT NULL )
+ GROUP BY tags.tagid, tags.cd, tags.tag
)',
+
[ [ 'tracks.id' => 666 ] ],
'Prefetch spec successfully stripped on search_related'
);
More information about the Bast-commits
mailing list