7 use DBIC::SqlMakerTest;
8 use DBIx::Class::SQLMaker::LimitDialects;
10 my ($ROWS, $OFFSET) = (
11 DBIx::Class::SQLMaker::LimitDialects->__rows_bindtype,
12 DBIx::Class::SQLMaker::LimitDialects->__offset_bindtype,
15 my $schema = DBICTest->init_schema();
17 my $rs = $schema->resultset('CD')->search({ -and => [
18 'me.artist' => { '!=', '666' },
19 'me.artist' => { '!=', \[ '?', [ _ne => 'bar' ] ] },
22 # bogus sql query to make sure bind composition happens properly
23 my $complex_rs = $rs->search({}, {
24 '+columns' => { cnt => $rs->count_rs->as_query },
25 '+select' => \[ 'me.artist + ?', [ _add => 1 ] ], # free select
26 group_by => ['me.cdid', \[ 'me.artist - ?', [ _sub => 2 ] ] ],
27 having => \[ 'me.artist < ?', [ _lt => 3 ] ],
28 order_by => \[ 'me.artist * ? ', [ _mu => 4 ] ],
35 $complex_rs->as_query,
37 SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track,
38 (SELECT COUNT( * ) FROM cd me WHERE me.artist != ? AND me.artist != ?),
41 WHERE me.artist != ? AND me.artist != ?
42 GROUP BY me.cdid, me.artist - ?
44 ORDER BY me.artist * ?
48 [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' } => 666 ],
49 [ { dbic_colname => '_ne' } => 'bar' ],
50 [ { dbic_colname => '_add' } => 1 ],
51 [ { sqlt_datatype => 'integer', dbic_colname => 'me.artist' } => 666 ],
52 [ { dbic_colname => '_ne' } => 'bar' ],
53 [ { dbic_colname => '_sub' } => 2 ],
54 [ { dbic_colname => '_lt' } => 3 ],
55 [ { dbic_colname => '_mu' } => 4 ],
63 # see if we get anything back at all
64 isa_ok ($complex_rs->next, 'DBIx::Class::Row');