[open-ils-commits] r20290 - branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 22 16:45:51 EDT 2011


Author: miker
Date: 2011-04-22 16:45:46 -0400 (Fri, 22 Apr 2011)
New Revision: 20290

Modified:
   branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
Log:
Address LP#730743, errant parens cause pain

Specifically, we prune subplans that contain no nodes (empty parens), and avoid dropping out of the top level query context when we encounter a close-paren.


Modified: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm	2011-04-22 20:44:30 UTC (rev 20289)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm	2011-04-22 20:45:46 UTC (rev 20290)
@@ -546,7 +546,7 @@
             warn "Encountered explicit group end\n" if $self->debug;
 
             $_ = $';
-            $remainder = $';
+            $remainder = $struct->top_plan ? '' : $';
 
             $last_type = '';
         } elsif ($self->filter_count && /$filter_re/) { # found a filter
@@ -593,7 +593,7 @@
             warn "Encountered explicit group start\n" if $self->debug;
 
             my ($substruct, $subremainder) = $self->decompose( $', $current_class, $recursing + 1 );
-            $struct->add_node( $substruct );
+            $struct->add_node( $substruct ) if ($substruct);
             $_ = $subremainder;
 
             $last_type = '';
@@ -685,6 +685,8 @@
 
     }
 
+    $struct = undef if (scalar(@{$struct->query_nodes}) == 0);
+
     return $struct if !wantarray;
     return ($struct, $remainder);
 }



More information about the open-ils-commits mailing list