Commit | Line | Data |
70350518 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
a47e1233 |
8 | my $schema = DBICTest->init_schema(); |
8417f5ee |
9 | |
10 | my $queries; |
11 | #$schema->storage->debugfh(IO::File->new('t/var/temp.trace', 'w')); |
12 | $schema->storage->debugcb( sub{ $queries++ } ); |
13 | |
14 | eval "use DBD::SQLite"; |
15 | plan skip_all => 'needs DBD::SQLite for testing' if $@; |
16 | plan tests => 2; |
17 | |
18 | |
19 | my $cd = $schema->resultset("CD")->find(1); |
20 | $cd->title('test'); |
21 | |
22 | # SELECT count |
23 | $queries = 0; |
24 | $schema->storage->debug(1); |
25 | |
26 | $cd->update; |
27 | |
28 | is($queries, 1, 'liner_notes (might_have) not prefetched - do not load |
29 | liner_notes on update'); |
30 | |
31 | $schema->storage->debug(0); |
32 | |
33 | |
34 | my $cd2 = $schema->resultset("CD")->find(2, {prefetch => 'liner_notes'}); |
50f18b6b |
35 | $cd2->title('test2'); |
8417f5ee |
36 | |
37 | # SELECT count |
38 | $queries = 0; |
39 | $schema->storage->debug(1); |
40 | |
41 | $cd2->update; |
42 | |
43 | is($queries, 1, 'liner_notes (might_have) prefetched - do not load |
44 | liner_notes on update'); |
45 | |
46 | $schema->storage->debug(0); |
8417f5ee |
47 | |