use lib qw(t/lib);
use DBIC::SqlMakerTest;
use DBICTest;
+use DBIx::Class::SQLMaker::LimitDialects;
+
+my ($ROWS, $OFFSET) = (
+ DBIx::Class::SQLMaker::LimitDialects->__rows_bindtype,
+ DBIx::Class::SQLMaker::LimitDialects->__offset_bindtype,
+);
my $schema = DBICTest->init_schema();
$filtered_cd_rs->as_query,
q{(
SELECT cds_unordered.cdid, cds_unordered.artist, cds_unordered.title, cds_unordered.year, cds_unordered.genreid, cds_unordered.single_track,
- tracks.trackid, tracks.cd, tracks.position, tracks.title, tracks.last_updated_on, tracks.last_updated_at, tracks.small_dt
+ tracks.trackid, tracks.cd, tracks.position, tracks.title, tracks.last_updated_on, tracks.last_updated_at
FROM artist me
JOIN (
SELECT cds_unordered.cdid, cds_unordered.artist, cds_unordered.title, cds_unordered.year, cds_unordered.genreid, cds_unordered.single_track
JOIN cd cds_unordered
ON cds_unordered.artist = me.artistid
WHERE ( me.rank = ? )
- GROUP BY cds_unordered.cdid, cds_unordered.artist, cds_unordered.title, cds_unordered.year, cds_unordered.genreid, cds_unordered.single_track, me.name, me.artistid
ORDER BY me.name ASC, me.artistid DESC
- LIMIT 3
- OFFSET 3
+ LIMIT ?
+ OFFSET ?
) cds_unordered
ON cds_unordered.artist = me.artistid
LEFT JOIN track tracks
WHERE ( me.rank = ? )
ORDER BY me.name ASC, me.artistid DESC, tracks.cd
)},
- [ [ 'me.rank' => 13 ], [ 'me.rank' => 13 ] ],
+ [
+ [ { sqlt_datatype => 'integer', dbic_colname => 'me.rank' } => 13 ],
+ [ $ROWS => 3 ],
+ [ $OFFSET => 3 ],
+ [ { sqlt_datatype => 'integer', dbic_colname => 'me.rank' } => 13 ],
+ ],
'correct SQL on limited prefetch over search_related ordered by root',
);
# cds belong to the second and third artist, respectively, and there's no sixth
# row
is_deeply (
- [ $filtered_cd_rs->hri_dump ],
+ $filtered_cd_rs->all_hri,
[
{
'artist' => '2',
'last_updated_at' => undef,
'last_updated_on' => undef,
'position' => '1',
- 'small_dt' => undef,
'title' => 'Boring Name',
'trackid' => '10'
},
'last_updated_at' => undef,
'last_updated_on' => undef,
'position' => '2',
- 'small_dt' => undef,
'title' => 'Boring Song',
'trackid' => '11'
},
'last_updated_at' => undef,
'last_updated_on' => undef,
'position' => '3',
- 'small_dt' => undef,
'title' => 'No More Ideas',
'trackid' => '12'
}
'last_updated_at' => undef,
'last_updated_on' => undef,
'position' => '1',
- 'small_dt' => undef,
'title' => 'Sad',
'trackid' => '13'
},
'last_updated_at' => undef,
'last_updated_on' => undef,
'position' => '3',
- 'small_dt' => undef,
'title' => 'Suicidal',
'trackid' => '15'
},
'last_updated_at' => undef,
'last_updated_on' => undef,
'position' => '2',
- 'small_dt' => undef,
'title' => 'Under The Weather',
'trackid' => '14'
}