1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
9 use DBIx::Class::_Util 'dump_value';
10 use DBICTest ':DiffSQL';
16 local $TODO = "Not implemented" if $args->{todo};
23 order_by => $args->{order_by},
25 [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', [ read_count => 8 ] ] ]
29 SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count
32 HAVING read_count > ? OR read_count < ?
33 ORDER BY $args->{order_req}
36 [ { sqlt_datatype => 'integer', dbic_colname => 'foo' }
38 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
40 [ { sqlt_datatype => 'int', dbic_colname => 'read_count' }
43 ? map { [ { dbic_colname => $_->[0] } => $_->[1] ] } @{ $args->{bind} }
46 ) || diag dump_value $args->{order_by};
52 order_by => \'foo DESC',
53 order_req => 'foo DESC',
57 order_by => { -asc => 'foo' },
58 order_req => 'foo ASC',
62 order_by => { -desc => \[ 'colA LIKE ?', [ colA => 'test' ] ] },
63 order_req => 'colA LIKE ? DESC',
64 bind => [ [ colA => 'test' ] ],
67 order_by => \[ 'colA LIKE ? DESC', [ colA => 'test' ] ],
68 order_req => 'colA LIKE ? DESC',
69 bind => [ [ colA => 'test' ] ],
73 { -asc => \['colA'] },
74 { -desc => \[ 'colB LIKE ?', [ colB => 'test' ] ] },
75 { -asc => \[ 'colC LIKE ?', [ colC => 'tost' ] ] },
77 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
78 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
84 { -desc => { colB => { 'LIKE' => 'test' } } },
85 { -asc => { colC => { 'LIKE' => 'tost' } } }
87 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
88 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ],
92 order_by => { -desc => { colA => { LIKE => 'test' } } },
93 order_req => 'colA LIKE ? DESC',
94 bind => [ [ colA => 'test' ] ],
98 my $rs = DBICTest->init_schema->resultset('FourKeys');
99 test_order($rs, $_) for @tests;