6 use Data::Dumper::Concise;
8 use DBICTest ':DiffSQL';
14 local $TODO = "Not implemented" if $args->{todo};
21 order_by => $args->{order_by},
23 [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', [ read_count => 8 ] ] ]
27 SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count
30 HAVING read_count > ? OR read_count < ?
31 ORDER BY $args->{order_req}
34 [ { sqlt_datatype => 'integer', dbic_colname => 'foo' }
36 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
38 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
41 ? map { [ { dbic_colname => $_->[0] } => $_->[1] ] } @{ $args->{bind} }
44 ) || diag Dumper $args->{order_by};
50 order_by => \'foo DESC',
51 order_req => 'foo DESC',
55 order_by => { -asc => 'foo' },
56 order_req => 'foo ASC',
60 order_by => { -desc => \[ 'colA LIKE ?', [ colA => 'test' ] ] },
61 order_req => 'colA LIKE ? DESC',
62 bind => [ [ colA => 'test' ] ],
65 order_by => \[ 'colA LIKE ? DESC', [ colA => 'test' ] ],
66 order_req => 'colA LIKE ? DESC',
67 bind => [ [ colA => 'test' ] ],
71 { -asc => \['colA'] },
72 { -desc => \[ 'colB LIKE ?', [ colB => 'test' ] ] },
73 { -asc => \[ 'colC LIKE ?', [ colC => 'tost' ] ] },
75 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
76 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
82 { -desc => { colB => { 'LIKE' => 'test' } } },
83 { -asc => { colC => { 'LIKE' => 'tost' } } }
85 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
86 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
90 order_by => { -desc => { colA => { LIKE => 'test' } } },
91 order_req => 'colA LIKE ? DESC',
92 bind => [ [ colA => 'test' ] ],
96 my $rs = DBICTest->init_schema->resultset('FourKeys');
97 test_order($rs, $_) for @tests;