Temporary fix or the IN ( ( ... ) ) problem until we get proper SQLA AST (needs SQLA...
[dbsrgits/DBIx-Class.git] / t / count / in_subquery.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Data::Dumper;
7
8 use Test::More;
9
10 plan ( tests => 1 );
11
12 use lib qw(t/lib);
13 use DBICTest;
14 use DBIC::SqlMakerTest;
15
16 my $schema = DBICTest->init_schema();
17
18 {
19     my $rs = $schema->resultset("CD")->search(
20         { 'artist.name' => 'Caterwauler McCrae' },
21         { join => [qw/artist/]}
22     );
23     my $squery = $rs->get_column('cdid')->as_query;
24     my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $squery } } );
25     is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
26 }