File: in_subquery.t

package info (click to toggle)
libdbix-class-perl 0.08123-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,520 kB
  • ctags: 1,695
  • sloc: perl: 19,821; sql: 353; makefile: 10
file content (24 lines) | stat: -rw-r--r-- 541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;

use Test::More;

plan ( tests => 1 );

use lib qw(t/lib);
use DBICTest;
use DBIC::SqlMakerTest;

my $schema = DBICTest->init_schema();

{
    my $rs = $schema->resultset("CD")->search(
        { 'artist.name' => 'Caterwauler McCrae' },
        { join => [qw/artist/]}
    );
    my $squery = $rs->get_column('cdid')->as_query;
    my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $squery } } );
    is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
}