X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fprefetch%2Fcorrelated.t;h=ac809f3f9d77534364052d7fb0cd248ec8f93cb6;hb=49eeb48de3d8ff685926b595fa0f3f5e680eaee2;hp=df349fc7942943ef5c2b5693c7f62756eed3159a;hpb=2cfc22ddff9cb35524031dfc9d429d294b5e3d6e;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/prefetch/correlated.t b/t/prefetch/correlated.t index df349fc..ac809f3 100644 --- a/t/prefetch/correlated.t +++ b/t/prefetch/correlated.t @@ -8,7 +8,6 @@ use DBICTest; use DBIC::SqlMakerTest; my $schema = DBICTest->init_schema(); -my $orig_debug = $schema->storage->debug; my $cdrs = $schema->resultset('CD')->search({ 'me.artist' => { '!=', 2 }}); @@ -63,26 +62,19 @@ is_same_sql_bind( 'Expected SQL on correlated realiased subquery' ); -my $queries = 0; -$schema->storage->debugcb(sub { $queries++; }); -$schema->storage->debug(1); - -cmp_deeply ( - { map - { $_->cdid => { - track_titles => [ map { $_->title } ($_->tracks->all) ], - siblings => $_->get_column ('sibling_count'), - } } - $c_rs->all - }, - $cd_data, - 'Proper information retrieved from correlated subquery' -); - -is ($queries, 1, 'Only 1 query fired to retrieve everything'); - -$schema->storage->debug($orig_debug); -$schema->storage->debugcb(undef); +$schema->is_executed_querycount( sub { + cmp_deeply ( + { map + { $_->cdid => { + track_titles => [ map { $_->title } ($_->tracks->all) ], + siblings => $_->get_column ('sibling_count'), + } } + $c_rs->all + }, + $cd_data, + 'Proper information retrieved from correlated subquery' + ); +}, 1, 'Only 1 query fired to retrieve everything'); # now add an unbalanced select/as pair $c_rs = $c_rs->search ({}, {