my $schema = DBICTest->init_schema();
+my $orig_debug = $schema->storage->debug;
+
use IO::File;
BEGIN {
is($queries, 1, 'prefetch ran only 1 select statement');
-$schema->storage->debug(0);
+$schema->storage->debug($orig_debug);
+$schema->storage->debugobj->callback(undef);
# test for partial prefetch via columns attr
my $cd = $schema->resultset('CD')->find(1,
is($queries, 1, 'find with prefetch ran exactly 1 select statement (excluding column_info)');
-$schema->storage->debug(0);
+$schema->storage->debug($orig_debug);
+$schema->storage->debugobj->callback(undef);
$rs = $schema->resultset('Tag')->search(
{},
$tree_like = $tree_like->parent;
is($tree_like->name, 'foo', 'Third level up ok');
-$schema->storage->debug(0);
+$schema->storage->debug($orig_debug);
+$schema->storage->debugobj->callback(undef);
cmp_ok($queries, '==', 1, 'Only one query run');
$tree_like = $tree_like->search_related('children', undef, { prefetch => { children => 'children' } })->first;
is($tree_like->children->first->children->first->name, 'quux', 'Tree search_related with prefetch ok');
-$schema->storage->debugcb(undef);
-$schema->storage->debug(1);
$tree_like = $schema->resultset('TreeLike')->search(
{ 'children.id' => 2, 'children_2.id' => 5 },
{ join => [qw/children children/] }
like( $sql, qr/^SELECT tracks.trackid/, "collapsed join didn't add _2 to alias" );
-$schema->storage->debug(0);
+$schema->storage->debug($orig_debug);
+$schema->storage->debugobj->callback(undef);