X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsqlmaker%2Flimit_dialects%2Fgeneric_subq.t;h=21a38d64c5608c683f44e73f10f74bfa2670669b;hb=fcb7fcbb6bde5f9a211c62011b3110f07828caec;hp=9e771a95d35dd92d1ca8ce26e5c24a8e591687cd;hpb=d763268755f6b9ee1d0d4d8442d989ef7c5a4d7d;p=dbsrgits%2FDBIx-Class.git diff --git a/t/sqlmaker/limit_dialects/generic_subq.t b/t/sqlmaker/limit_dialects/generic_subq.t index 9e771a9..21a38d6 100644 --- a/t/sqlmaker/limit_dialects/generic_subq.t +++ b/t/sqlmaker/limit_dialects/generic_subq.t @@ -5,6 +5,13 @@ use Test::More; 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; @@ -34,10 +41,13 @@ is_same_sql_bind( 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 ( @@ -75,10 +85,14 @@ is_same_sql_bind( 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 ( @@ -110,10 +124,14 @@ is_same_sql_bind( 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 (