X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=t%2Fprefetch%2Fwith_limit.t;h=977a3f926212aa0c8e2c55193e3b5b17e01c17dd;hp=f6729b176d8f56191fb4f9fd25b671bf1a56200a;hb=0e773352a;hpb=402ac1c9aa0b5bb5120ee8f6d8e62298a7a14223 diff --git a/t/prefetch/with_limit.t b/t/prefetch/with_limit.t index f6729b1..977a3f9 100644 --- a/t/prefetch/with_limit.t +++ b/t/prefetch/with_limit.t @@ -31,7 +31,7 @@ my $use_prefetch = $no_prefetch->search( } ); -# add a floating +select to make sure it does nto throw things off +# add a floating +select to make sure it does not throw things off # we also expect it to appear in both selectors, as we can not know # for sure which part of the query it applies to (may be order_by, # maybe something else) @@ -39,11 +39,15 @@ my $use_prefetch = $no_prefetch->search( # we use a reference to the same array in bind vals, because # is_deeply picks up this difference too (not sure if bug or # feature) -my $bind_one = [ __add => 1 ]; $use_prefetch = $use_prefetch->search({}, { - '+select' => \[ 'me.artistid + ?', $bind_one ], + '+select' => \[ 'me.artistid + ?', [ \ 'inTEger' => 1 ] ], }); +my $bind_int_resolved = sub { [ { sqlt_datatype => 'inTEger' } => 1 ] }; +my $bind_vc_resolved = sub { [ + { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'tracks.title' } + => 'blah-blah-1234568' +] }; is_same_sql_bind ( $use_prefetch->as_query, '( @@ -77,12 +81,12 @@ is_same_sql_bind ( ORDER BY name DESC, cds.artist, cds.year ASC )', [ - $bind_one, # outer select - $bind_one, # inner select - [ 'tracks.title' => 'blah-blah-1234568' ], # inner where - $bind_one, # inner group_by - [ 'tracks.title' => 'blah-blah-1234568' ], # outer where - $bind_one, # outer group_by + $bind_int_resolved->(), # outer select + $bind_int_resolved->(), # inner select + $bind_vc_resolved->(), # inner where + $bind_int_resolved->(), # inner group_by + $bind_vc_resolved->(), # outer where + $bind_int_resolved->(), # outer group_by ], 'Expected SQL on complex limited prefetch' ); @@ -184,12 +188,12 @@ is_same_sql_bind ( WHERE ( ( artist.name = ? AND me.year = ? ) ) ORDER BY tracks.cd )', - [ - [ 'artist.name' => 'foo' ], - [ 'me.year' => 2010 ], - [ 'artist.name' => 'foo' ], - [ 'me.year' => 2010 ], - ], + [ map { + [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'artist.name' } + => 'foo' ], + [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'me.year' } + => 2010 ], + } (1,2)], 'No grouping of non-multiplying resultsets', );