X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=t%2Fprefetch%2Fcorrelated.t;h=fd5ef1dd15cf32e9a375d6c7815c355b1c3d99c5;hp=7e7690de5ce66b60418446f74ca95e94f9f9b9e9;hb=0e773352a;hpb=402ac1c9aa0b5bb5120ee8f6d8e62298a7a14223 diff --git a/t/prefetch/correlated.t b/t/prefetch/correlated.t index 7e7690d..fd5ef1d 100644 --- a/t/prefetch/correlated.t +++ b/t/prefetch/correlated.t @@ -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' );