From: Dan Scott <dan@coffeecode.net>
Date: Mon, 13 Jun 2011 13:45:39 +0000 (-0400)
Subject: Prevent uninit var warnings in QueryParser.pm
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=da0b6c44881f85509822802e58774488d84a2059;p=evergreen%2Fmasslnc.git

Prevent uninit var warnings in QueryParser.pm

$suffix_op and $prefix_op would not be defined if $suffix or $prefix did
not evaluate to true, leading to warnings about undefined variables in
open-ils.storage_stderr.log.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
---

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index b858fd55bd..8cd490cd26 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -834,8 +834,11 @@ sub buildSQL {
     my $suffix = $self->suffix || '';
 
     $prefix = "'$prefix' ||" if $prefix;
-    my $suffix_op = ":$suffix" if $suffix;
-    my $suffix_after = "|| '$suffix_op'" if $suffix;
+    my $suffix_op = '';
+    my $suffix_after = '';
+
+    $suffix_op = ":$suffix" if $suffix;
+    $suffix_after = "|| '$suffix_op'" if $suffix;
 
     $sql = "to_tsquery('$classname', COALESCE(NULLIF($prefix '(' || btrim(regexp_replace($sql,E'(?:\\\\s+|:)','$suffix_op&','g'),'&|') $suffix_after || ')', '()'), ''))";