From: Ash Berlin Date: Sun, 29 Mar 2009 22:58:21 +0000 (+0100) Subject: Make LIKE op work X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db861e66130220a915c2a9b9c19f80b6c66c8294;hp=1c51edc4084912d35b9ed542bba9f3199705a678;p=dbsrgits%2FSQL-Abstract-2.0-ish.git Make LIKE op work --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 848c01a..194792e 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -31,8 +31,8 @@ class SQL::Abstract { '==' => '=', '!=' => '!=', # LIKE is always "field LIKE " - '-like' => 'LIKE', - '-not_like' => 'NOT LIKE', + 'like' => 'LIKE', + 'not_like' => 'NOT LIKE', ); has expr_dispatch_table => ( diff --git a/t/100_expr_basic.t b/t/100_expr_basic.t index f44d884..de43e64 100644 --- a/t/100_expr_basic.t +++ b/t/100_expr_basic.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 14; use Test::Differences; use_ok('SQL::Abstract') or BAIL_OUT( "$@" ); @@ -178,3 +178,15 @@ eq_or_diff( ], "NOT IN clause"); + + +is $sqla->dispatch( + { -type => 'expr', + op => 'like', + args => [ + {-type => name => args => [qw/me id/] }, + { -type => 'value', value => 500 } + ] + } +), "me.id LIKE ?", + "LIKE expr clause";