use lib qw(t/lib);
use DBICTest;
use DBIC::SqlMakerTest;
+use DBIx::Class::SQLMaker::LimitDialects;
+my ($ROWS, $TOTAL, $OFFSET) = (
+ DBIx::Class::SQLMaker::LimitDialects->__rows_bindtype,
+ DBIx::Class::SQLMaker::LimitDialects->__total_bindtype,
+ DBIx::Class::SQLMaker::LimitDialects->__offset_bindtype,
+);
+
my $schema = DBICTest->init_schema;
SELECT COUNT(*)
FROM books rownum__emulation
WHERE rownum__emulation.title < me.title
- ) < 2
+ ) < ?
ORDER BY me.title
)',
- [ [ 'source', 'Library' ] ],
+ [
+ [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' } => 'Library' ],
+ [ $ROWS => 2 ],
+ ],
);
is_deeply (
SELECT COUNT(*)
FROM "books" "rownum__emulation"
WHERE "rownum__emulation"."title" > "me"."title"
- ) BETWEEN 1 AND 3
+ ) BETWEEN ? AND ?
ORDER BY "title" DESC
)',
- [ [ 'source', 'Library' ] ],
+ [
+ [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' } => 'Library' ],
+ [ $OFFSET => 1 ],
+ [ $TOTAL => 3 ],
+ ],
);
is_deeply (
SELECT COUNT(*)
FROM "books" "rownum__emulation"
WHERE "rownum__emulation"."title" < "me"."title"
- ) BETWEEN 1 AND 4294967295
+ ) BETWEEN ? AND ?
ORDER BY "title"
)',
- [ [ 'source', 'Library' ] ],
+ [
+ [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' } => 'Library' ],
+ [ $OFFSET => 1 ],
+ [ $TOTAL => 2147483647 ],
+ ],
);
is_deeply (
{
$rs = $schema->resultset('Artist')->search({}, {
- columns => 'name',
+ columns => 'artistid',
offset => 1,
- order_by => 'name',
+ order_by => 'artistid',
});
local $rs->result_source->{name} = "weird \n newline/multi \t \t space containing \n table";