Fix parsing of foo.* in SQLA::Tree
Dagfinn Ilmari Mannsåker [Tue, 9 Nov 2010 11:40:31 +0000 (11:40 +0000)]
Changes
lib/SQL/Abstract/Tree.pm
t/11unparse.t

diff --git a/Changes b/Changes
index 89d3b94..2d02973 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 Revision history for SQL::Abstract
 
+    - Fix parsing of foo.* in SQLA::Tree
+
 revision 1.71  2010-11-09
 ----------------------------
     - Add EXECUTING for clarity of long running SQL
index b9815dc..9536ce9 100644 (file)
@@ -122,8 +122,8 @@ sub _binary_op_re { $binary_op_re }
 my $all_known_re = join("\n\t|\n",
   $expr_start_re,
   $binary_op_re,
-  "$op_look_behind (?i: AND|OR|NOT ) $op_look_ahead",
-  (map { quotemeta $_ } qw/, ( ) */),
+  "$op_look_behind (?i: AND|OR|NOT|\\* ) $op_look_ahead",
+  (map { quotemeta $_ } qw/, ( )/),
   $placeholder_re,
 );
 
index e61416b..f45b5e4 100644 (file)
@@ -7,7 +7,7 @@ use SQL::Abstract::Tree;
 
 my $sqlat = SQL::Abstract::Tree->new;
 
-cmp_deeply($sqlat->parse("SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE 'station'"), [
+cmp_deeply($sqlat->parse("SELECT a, b.*, * FROM foo WHERE foo.a =1 and foo.b LIKE 'station'"), [
   [
     [
       "SELECT",
@@ -24,13 +24,13 @@ cmp_deeply($sqlat->parse("SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE
             [
               "LITERAL",
               [
-                "b"
+                "b.*"
               ]
             ],
             [
               "LITERAL",
               [
-                "c"
+                "*"
               ]
             ]
           ]