7 use DBIC::SqlMakerTest;
9 my $schema = DBICTest->init_schema;
11 my $rs = $schema->resultset('FourKeys');
18 ? "ORDER BY $args->{order_req}"
25 order_by => $args->{order_by},
27 [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', 8 ] ]
31 SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count
34 HAVING read_count > ? OR read_count < ?
38 [qw(foo bar)], [qw(read_count 5)],
39 8, $args->{bind} ? @{ $args->{bind} } : ()
46 order_by => \'foo DESC',
47 order_req => 'foo DESC',
51 order_by => { -asc => 'foo' },
52 order_req => 'foo ASC',
56 order_by => { -desc => \[ 'colA LIKE ?', 'test' ] },
57 order_req => 'colA LIKE ? DESC',
61 order_by => \[ 'colA LIKE ? DESC', 'test' ],
62 order_req => 'colA LIKE ? DESC',
67 { -asc => \['colA'] },
68 { -desc => \[ 'colB LIKE ?', 'test' ] },
69 { -asc => \[ 'colC LIKE ?', 'tost' ] }
71 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
72 bind => [qw(test tost)],
74 { # this would be really really nice!
77 { -desc => { colB => { 'LIKE' => 'test' } } },
78 { -asc => { colC => { 'LIKE' => 'tost' } } }
80 order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
81 bind => [ [ colB => 'test' ], [ colC => 'tost' ] ], # ???
84 order_by => { -desc => { colA => { LIKE => 'test' } } },
85 order_req => 'colA LIKE ? DESC',
90 plan( tests => scalar @tests );
92 test_order($_) for @tests;