10 use DBIC::SqlMakerTest;
12 my $schema = DBICTest->init_schema();
13 my $art_rs = $schema->resultset('Artist');
14 my $cdrs = $schema->resultset('CD');
19 "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me)", [],
23 $art_rs = $art_rs->search({ name => 'Billy Joel' });
28 "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? ))",
29 [ [ name => 'Billy Joel' ] ],
33 $art_rs = $art_rs->search({ rank => 2 });
38 "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
39 [ [ rank => 2 ], [ name => 'Billy Joel' ] ],
43 my $rscol = $art_rs->get_column( 'charfield' );
48 "(SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
49 [ [ rank => 2 ], [ name => 'Billy Joel' ] ],
54 my $rs = $schema->resultset("CD")->search(
55 { 'artist.name' => 'Caterwauler McCrae' },
56 { join => [qw/artist/]}
58 my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $rs->get_column('cdid')->as_query } } );
59 is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');