Parameterize pagination
[dbsrgits/DBIx-Class.git] / t / sqlmaker / limit_dialects / rownum.t
index 2fa12ca..841f883 100644 (file)
@@ -6,6 +6,12 @@ use Test::More;
 use lib qw(t/lib);
 use DBICTest;
 use DBIC::SqlMakerTest;
+use DBIx::Class::SQLMaker::LimitDialects;
+
+my ($TOTAL, $OFFSET) = (
+   DBIx::Class::SQLMaker::LimitDialects->__total_bindtype,
+   DBIx::Class::SQLMaker::LimitDialects->__offset_bindtype,
+);
 
 my $s = DBICTest->init_schema (no_deploy => 1, );
 $s->storage->sql_maker->limit_dialect ('RowNum');
@@ -26,11 +32,14 @@ is_same_sql_bind (
             SELECT foo.id AS id, bar.id AS bar__id, TO_CHAR(foo.womble, "blah") AS bleh
               FROM cd me
           ) me
-        WHERE ROWNUM <= 4
+        WHERE ROWNUM <= ?
       ) me
-    WHERE rownum__index >= 4
+    WHERE rownum__index >= ?
   )',
-  [],
+  [
+    [ $TOTAL => 4 ],
+    [ $OFFSET => 4 ],
+  ],
   'Rownum subsel aliasing works correctly'
 );
 
@@ -46,11 +55,14 @@ is_same_sql_bind (
             SELECT foo.id AS id, ends_with_me.id AS ends_with_me__id
               FROM cd me
           ) me
-        WHERE ROWNUM <= 5
+        WHERE ROWNUM <= ?
       ) me
-    WHERE rownum__index >= 4
+    WHERE rownum__index >= ?
   )',
-  [],
+  [
+    [ $TOTAL => 5 ],
+    [ $OFFSET => 4 ],
+  ],
   'Rownum subsel aliasing works correctly'
 );