4 use warnings FATAL => 'all';
12 my $schema = DBICTest->init_schema();
13 my $art_rs = $schema->resultset('Artist');
16 my $arr = $art_rs->as_query;
17 my ($query, @bind) = @$arr;
19 is( $query, "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me" );
20 is_deeply( \@bind, [] );
23 $art_rs = $art_rs->search({ name => 'Billy Joel' });
26 my $arr = $art_rs->as_query;
27 my ($query, @bind) = @$arr;
29 is( $query, "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? )" );
30 is_deeply( \@bind, [ [ name => 'Billy Joel' ] ] );
33 $art_rs = $art_rs->search({ rank => 2 });
36 my $arr = $art_rs->as_query;
37 my ($query, @bind) = @$arr;
39 is( $query, "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )" );
40 is_deeply( \@bind, [ [ rank => 2 ], [ name => 'Billy Joel' ] ] );