[open-ils-commits] r20297 - in branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage: . Driver/Pg (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 22 17:37:18 EDT 2011


Author: miker
Date: 2011-04-22 17:37:12 -0400 (Fri, 22 Apr 2011)
New Revision: 20297

Modified:
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
Log:
address the empty-query case

Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2011-04-22 21:35:30 UTC (rev 20296)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2011-04-22 21:37:12 UTC (rev 20297)
@@ -523,6 +523,13 @@
 
     my $core_limit = $self->QueryParser->core_limit || 25000;
 
+    my $flat_where = $$flat_plan{where};
+    if ($flat_where eq '()') {
+        $flat_where = '';
+    } else {
+        $flat_where = "AND $flat_where";
+    }
+
     my $sql = <<SQL;
 SELECT  $key AS id,
         ARRAY_ACCUM(DISTINCT m.source) AS records,
@@ -544,7 +551,7 @@
         $lit_form
         $language
         $bib_level
-        AND $$flat_plan{where}
+        $flat_where
   GROUP BY 1
   ORDER BY 4 $desc NULLS LAST, 5 DESC NULLS LAST, 3 DESC
   LIMIT $core_limit

Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm	2011-04-22 21:35:30 UTC (rev 20296)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/QueryParser.pm	2011-04-22 21:37:12 UTC (rev 20297)
@@ -650,7 +650,7 @@
 
     }
 
-    $struct = undef if (scalar(@{$struct->query_nodes}) == 0);
+    $struct = undef if (scalar(@{$struct->query_nodes}) == 0 && !$struct->top_plan);
 
     return $struct if !wantarray;
     return ($struct, $remainder);



More information about the open-ils-commits mailing list