8 use DBIC::SqlMakerTest;
11 my $schema = DBICTest->init_schema();
13 my $rs = $schema->resultset('CD')->search (
14 { 'tracks.id' => { '!=', 666 }},
15 { join => 'artist', prefetch => 'tracks', rows => 2 }
18 my $rel_rs = $rs->search_related ('tags', { 'tags.tag' => { '!=', undef }}, { distinct => 1});
23 SELECT tags.tagid, tags.cd, tags.tag
25 SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track
27 JOIN artist artist ON artist.artistid = me.artist
28 LEFT JOIN track tracks ON tracks.cd = me.cdid
29 WHERE ( tracks.id != ? )
32 JOIN artist artist ON artist.artistid = me.artist
33 LEFT JOIN track tracks ON tracks.cd = me.cdid
34 JOIN tags tags ON tags.cd = me.cdid
35 WHERE ( tags.tag IS NOT NULL )
36 GROUP BY tags.tagid, tags.cd, tags.tag
39 [ [ 'tracks.id' => 666 ] ],
40 'Prefetch spec successfully stripped on search_related'