6 use Data::Dumper::Concise;
9 use DBIC::SqlMakerTest;
15 local $TODO = "Not implemented" if $args->{todo};
22 order_by => $args->{order_by},
24 [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', [ read_count => 8 ] ] ]
28 SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count
31 HAVING read_count > ? OR read_count < ?
32 ORDER BY $args->{order_req}
35 [ { sqlt_datatype => 'integer', dbic_colname => 'foo' }
37 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
39 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
42 ? map { [ { dbic_colname => $_->[0] } => $_->[1] ] } @{ $args->{bind} }
45 ) || diag Dumper $args->{order_by};
51 order_by => \'foo DESC',
52 order_req => 'foo DESC',
56 order_by => { -asc => 'foo' },
57 order_req => 'foo ASC',
61 order_by => { -desc => \[ 'colA LIKE ?', [ colA => 'test' ] ] },
62 order_req => 'colA LIKE ? DESC',
63 bind => [ [ colA => 'test' ] ],
66 order_by => \[ 'colA LIKE ? DESC', [ colA => 'test' ] ],
67 order_req => 'colA LIKE ? DESC',
68 bind => [ [ colA => 'test' ] ],
72 { -asc => \['colA'] },
73 { -desc => \[ 'colB LIKE ?', [ colB => 'test' ] ] },
74 { -asc => \[ 'colC LIKE ?', [ colC => 'tost' ] ] },
76 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
77 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
83 { -desc => { colB => { 'LIKE' => 'test' } } },
84 { -asc => { colC => { 'LIKE' => 'tost' } } }
86 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
87 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
91 order_by => { -desc => { colA => { LIKE => 'test' } } },
92 order_req => 'colA LIKE ? DESC',
93 bind => [ [ colA => 'test' ] ],
97 my $rs = DBICTest->init_schema->resultset('FourKeys');
98 test_order($rs, $_) for @tests;