8 use DBIC::SqlMakerTest;
10 use DBIx::Class::SQLMaker::LimitDialects;
12 my $ROWS = DBIx::Class::SQLMaker::LimitDialects->__rows_bindtype;
14 my $schema = DBICTest->init_schema();
16 my $rs = $schema->resultset('CD')->search (
17 { 'tracks.trackid' => { '!=', 666 }},
18 { join => 'artist', prefetch => 'tracks', rows => 2 }
21 my $rel_rs = $rs->search_related ('tags', { 'tags.tag' => { '!=', undef }}, { distinct => 1});
26 SELECT tags.tagid, tags.cd, tags.tag
28 SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track
30 JOIN artist artist ON artist.artistid = me.artist
31 LEFT JOIN track tracks ON tracks.cd = me.cdid
32 WHERE ( tracks.trackid != ? )
35 JOIN artist artist ON artist.artistid = me.artist
36 JOIN tags tags ON tags.cd = me.cdid
37 WHERE ( tags.tag IS NOT NULL )
38 GROUP BY tags.tagid, tags.cd, tags.tag
42 [ { sqlt_datatype => 'integer', dbic_colname => 'tracks.trackid' } => 666 ],
45 'Prefetch spec successfully stripped on search_related'