X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F02where.t;h=e6e1eddd4b5b353f2104e6caba93f3332934a055;hb=10e6c94609fc94467ef8f281ffe192d8038ffc9e;hp=55929772d36815c76409cf668ff1bb4a5f9d2c04;hpb=e24e301245ca182eef79fa211ce1713e0a176fe7;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/02where.t b/t/02where.t index 5592977..e6e1edd 100644 --- a/t/02where.t +++ b/t/02where.t @@ -201,6 +201,24 @@ my @handle_tests = ( stmt => " WHERE ( (bar > ? AND bar < ?) AND foo IN (?, ?) )", bind => [44, 55, 22, 33], }, + + { + where => { + -and => [ + user => 'nwiger', + [ + -and => [ workhrs => {'>', 20}, geo => 'ASIA' ], + -or => { workhrs => {'<', 50}, geo => 'EURO' }, + ], + ], + }, + stmt => "WHERE ( user = ? AND ( + ( workhrs > ? AND geo = ? ) + OR ( geo = ? OR workhrs < ? ) + ) )", + bind => [qw/nwiger 20 ASIA EURO 50/], + }, + { where => { -and => [{}, { 'me.id' => '1'}] }, stmt => " WHERE ( ( me.id = ? ) )", @@ -328,8 +346,8 @@ my @handle_tests = ( bind => [], }, { - where => { timestamp => { '>=' => { -TO_DATE => '2009-12-21 00:00:00' } } }, - stmt => " WHERE ( timestamp >= TO DATE ? )", + where => { timestamp => { '>=' => { -to_date => '2009-12-21 00:00:00' } } }, + stmt => " WHERE ( timestamp >= TO_DATE ? )", bind => ['2009-12-21 00:00:00'], }, @@ -384,8 +402,6 @@ my @handle_tests = ( }, ); -plan tests => ( @handle_tests * 2 ) + 1; - for my $case (@handle_tests) { local $Data::Dumper::Terse = 1; my $sql = SQL::Abstract->new; @@ -401,3 +417,5 @@ dies_ok { my $sql = SQL::Abstract->new; $sql->where({ foo => { '>=' => [] }},); }; + +done_testing;