Fix building on perls with no . in @INC
[dbsrgits/DBIx-Class.git] / t / search / empty_attrs.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
d16df239 3use strict;
4use warnings;
5
6use Test::More;
7
c0329273 8
d16df239 9use DBICTest ':DiffSQL';
10
11my $schema = DBICTest->init_schema();
12
13my $rs = $schema->resultset('Artist')->search(
14 [ -and => [ {}, [] ], -or => [ {}, [] ] ],
15 {
16 select => [],
17 columns => {},
18 '+columns' => 'artistid',
19 join => [ {}, [ [ {}, {} ] ], {} ],
20 prefetch => [ [ [ {}, [] ], {} ], {}, [ {} ] ],
21 order_by => [],
22 group_by => [],
23 offset => 0,
24 }
25);
26
27is_same_sql_bind(
28 $rs->as_query,
29 '(SELECT me.artistid FROM artist me)',
30 [],
31);
32
33is_same_sql_bind(
34 $rs->count_rs->as_query,
35 '(SELECT COUNT(*) FROM artist me)',
36 [],
37);
38
39is_same_sql_bind(
40 $rs->as_subselect_rs->search({}, { columns => 'artistid' })->as_query,
41 '(SELECT me.artistid FROM (SELECT me.artistid FROM artist me) me)',
42 [],
43);
44
45{
46 local $TODO = 'Stupid misdesigned as_subselect_rs';
47 is_same_sql_bind(
48 $rs->as_subselect_rs->as_query,
49 $rs->as_subselect_rs->search({}, { columns => 'artistid' })->as_query,
50 );
51}
52
53done_testing;