4 use warnings FATAL => 'all';
14 use DBIC::SqlMakerTest;
16 my $schema = DBICTest->init_schema();
17 my $art_rs = $schema->resultset('Artist');
18 my $cdrs = $schema->resultset('CD');
23 "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me)", [],
27 $art_rs = $art_rs->search({ name => 'Billy Joel' });
32 "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? ))",
33 [ [ name => 'Billy Joel' ] ],
37 $art_rs = $art_rs->search({ rank => 2 });
42 "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
43 [ [ rank => 2 ], [ name => 'Billy Joel' ] ],
47 my $rscol = $art_rs->get_column( 'charfield' );
52 "(SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
53 [ [ rank => 2 ], [ name => 'Billy Joel' ] ],
58 my $rs = $schema->resultset("CD")->search(
59 { 'artist.name' => 'Caterwauler McCrae' },
60 { join => [qw/artist/]}
62 my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $rs->get_column('cdid')->as_query } } );
63 is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');