Massive rewrite of bind handling, and overall simplification of ::Storage::DBI
[dbsrgits/DBIx-Class.git] / t / prefetch / correlated.t
index 7e7690d..fd5ef1d 100644 (file)
@@ -24,7 +24,7 @@ my $c_rs = $cdrs->search ({}, {
   '+columns' => { sibling_count => $cdrs->search(
       {
         'siblings.artist' => { -ident => 'me.artist' },
-        'siblings.cdid' => { '!=' => ['-and', { -ident => 'me.cdid' }, 'bogus condition'] },
+        'siblings.cdid' => { '!=' => ['-and', { -ident => 'me.cdid' }, 23414] },
       }, { alias => 'siblings' },
     )->count_rs->as_query,
   },
@@ -51,11 +51,15 @@ is_same_sql_bind(
   [
 
     # subselect
-    [ 'siblings.cdid' => 'bogus condition' ],
-    [ 'me.artist' => 2 ],
+    [ { sqlt_datatype => 'integer', dbic_colname => 'siblings.cdid' }
+      => 23414 ],
+
+    [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' }
+      => 2 ],
 
     # outher WHERE
-    [ 'me.artist' => 2 ],
+    [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' }
+      => 2 ],
   ],
   'Expected SQL on correlated realiased subquery'
 );
@@ -85,7 +89,7 @@ $schema->storage->debugcb(undef);
 
 # first add a lone non-as-ed select
 # it should be reordered to appear at the end without throwing prefetch/bind off
-$c_rs = $c_rs->search({}, { '+select' => \[ 'me.cdid + ?', [ __add => 1 ] ] });
+$c_rs = $c_rs->search({}, { '+select' => \[ 'me.cdid + ?', [ \ 'inTEger' => 1 ] ] });
 
 # now add an unbalanced select/as pair
 $c_rs = $c_rs->search ({}, {
@@ -127,17 +131,23 @@ is_same_sql_bind(
   [
 
     # first subselect
-    [ 'siblings.cdid' => 'bogus condition' ],
-    [ 'me.artist' => 2 ],
+    [ { sqlt_datatype => 'integer', dbic_colname => 'siblings.cdid' }
+      => 23414 ],
+
+    [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' }
+      => 2 ],
 
     # second subselect
-    [ 'me.artist' => 2 ],
+    [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' }
+      => 2 ],
 
     # the addition
-    [ __add => 1 ],
+    [ { sqlt_datatype => 'inTEger' }
+      => 1 ],
 
     # outher WHERE
-    [ 'me.artist' => 2 ],
+    [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' }
+      => 2 ],
   ],
   'Expected SQL on correlated realiased subquery'
 );