From: Peter Rabbitson Date: Sun, 22 Mar 2009 22:12:17 +0000 (+0000) Subject: Consider 'X BETWEEN' a statement keyword X-Git-Tag: v1.70~203 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6c8b01b36078f748e58b807333a479dd04c4e39;p=dbsrgits%2FSQL-Abstract.git Consider 'X BETWEEN' a statement keyword --- diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index 0500ffa..562832b 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -38,6 +38,7 @@ my @expression_terminator_sql_keywords = ( )', 'ON', 'WHERE', + '[\`\w]+ \s+ BETWEEN', 'GROUP \s+ BY', 'HAVING', 'ORDER \s+ BY', @@ -342,7 +343,7 @@ sub _recurse_parse { } # expression terminator keywords (as they start a new expression) elsif (grep { $token =~ /^ $_ $/xi } @expression_terminator_sql_keywords ) { - my $op = uc $token; + my $op = $token; my $right = _recurse_parse($tokens, PARSE_IN_EXPR); $left = $left ? [@$left, [$op => [$right] ]] : [ [$op => [$right] ] ]; diff --git a/t/10test.t b/t/10test.t index d099cbd..8cb108b 100644 --- a/t/10test.t +++ b/t/10test.t @@ -200,6 +200,13 @@ my @sql_tests = ( q/SELECT foo FROM bar WHERE a = 1 OR (b = 1 AND c = 1)/, ] }, + { + equal => 0, + statements => [ + q/SELECT foo FROM bar WHERE ( completion_date BETWEEN ? AND ? AND status = ? )/, + q/SELECT foo FROM bar WHERE ( (completion_date BETWEEN ? AND ?) AND status = ? )/, + ] + }, # JOIN condition - equal {