6 use Data::Dumper::Concise;
9 use DBIC::SqlMakerTest;
11 my $schema = DBICTest->init_schema;
13 my $rs = $schema->resultset('FourKeys');
20 local $TODO = "Not implemented" if $args->{todo};
27 order_by => $args->{order_by},
29 [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', [ read_count => 8 ] ] ]
33 SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count
36 HAVING read_count > ? OR read_count < ?
37 ORDER BY $args->{order_req}
40 [ { sqlt_datatype => 'integer', dbic_colname => 'foo' }
42 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
44 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
47 ? map { [ { dbic_colname => $_->[0] } => $_->[1] ] } @{ $args->{bind} }
50 ) || diag Dumper $args->{order_by};
57 order_by => \'foo DESC',
58 order_req => 'foo DESC',
62 order_by => { -asc => 'foo' },
63 order_req => 'foo ASC',
67 order_by => { -desc => \[ 'colA LIKE ?', [ colA => 'test' ] ] },
68 order_req => 'colA LIKE ? DESC',
69 bind => [ [ colA => 'test' ] ],
72 order_by => \[ 'colA LIKE ? DESC', [ colA => 'test' ] ],
73 order_req => 'colA LIKE ? DESC',
74 bind => [ [ colA => 'test' ] ],
78 { -asc => \['colA'] },
79 { -desc => \[ 'colB LIKE ?', [ colB => 'test' ] ] },
80 { -asc => \[ 'colC LIKE ?', [ colC => 'tost' ] ] },
82 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
83 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
89 { -desc => { colB => { 'LIKE' => 'test' } } },
90 { -asc => { colC => { 'LIKE' => 'tost' } } }
92 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
93 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
97 order_by => { -desc => { colA => { LIKE => 'test' } } },
98 order_req => 'colA LIKE ? DESC',
99 bind => [ [ colA => 'test' ] ],
103 test_order($_) for @tests;