revert previous revision
[dbsrgits/DBIx-Class.git] / t / 98rows_prefetch.t
CommitLineData
a04af85f 1# Test to ensure we get a consistent result set wether or not we use the
2# prefetch option in combination rows (LIMIT).
3use strict;
4use warnings;
5
6use Test::More;
7use lib qw(t/lib);
8use DBICTest;
9
10plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 2);
11
12my $schema = DBICTest->init_schema();
13my $no_prefetch = $schema->resultset('Artist')->search(
14 undef,
15 { rows => 3 }
16);
17
18my $use_prefetch = $schema->resultset('Artist')->search(
19 undef,
20 {
21 prefetch => 'cds',
22 rows => 3
23 }
24);
25
26my $no_prefetch_count = 0;
27my $use_prefetch_count = 0;
28
29is($no_prefetch->count, $use_prefetch->count, '$no_prefetch->count == $use_prefetch->count');
30
31TODO: {
32 local $TODO = "This is a difficult bug to fix, workaround is not to use prefetch with rows";
33 $no_prefetch_count++ while $no_prefetch->next;
34 $use_prefetch_count++ while $use_prefetch->next;
35 is(
36 $no_prefetch_count,
37 $use_prefetch_count,
38 "manual row count confirms consistency"
39 . " (\$no_prefetch_count == $no_prefetch_count, "
40 . " \$use_prefetch_count == $use_prefetch_count)"
41 );
42}