10 my $schema = DBICTest->init_schema( no_populate => 1 );
12 $schema->resultset('CD')->create({
13 cdid => 0, title => '', year => 0, genreid => 0, single_track => 0, artist => {
14 artistid => 0, name => '', rank => 0, charfield => 0,
18 my $orig_debug = $schema->storage->debug;
21 $schema->storage->debugcb(sub { $queries++; });
22 $schema->storage->debug(1);
24 my $cd = $schema->resultset('CD')->search( {}, { prefetch => 'artist' })->next;
28 { artist => 0, cdid => 0, genreid => 0, single_track => 0, title => '', year => 0 },
29 'Expected CD columns present',
33 { $cd->artist->get_columns },
34 { artistid => 0, charfield => 0, name => "", rank => 0 },
35 'Expected Artist columns present',
38 is $queries, 1, 'Only one query fired - prefetch worked';
40 $schema->storage->debugcb(undef);
41 $schema->storage->debug($orig_debug);