Fix fuzzy search (by function), broken by the last commit
authorVincent Tondellier <tonton+hg@team1664.org>
Sat, 26 Nov 2016 15:48:43 +0100
changeset 117 2a86951f0c03
parent 116 39449f7dab99
child 118 a8ff5a8a4fe8
Fix fuzzy search (by function), broken by the last commit
lib/CrashTest/Plugin/Storage/Sql/Utils.pm
--- a/lib/CrashTest/Plugin/Storage/Sql/Utils.pm	Sun Nov 20 20:57:40 2016 +0100
+++ b/lib/CrashTest/Plugin/Storage/Sql/Utils.pm	Sat Nov 26 15:48:43 2016 +0100
@@ -36,7 +36,7 @@
     # define a callback to collect values safely (without magic markers)
     my $cb = sub {
         my ($column, $this_op, $value) = @_;
-        my $sql = join('', $column->stringify, $this_op, '?');
+        my $sql;
 
         if($column->type eq "fuzzy") {
             if ( $this_op =~ /!|NOT/ ) {
@@ -49,6 +49,11 @@
             $sql = $column->name;
             $sql =~ s/\s+\?op\?\s+/ $this_op /;
         }
+
+        if(!defined($sql)) {
+            $sql = join('', $column->stringify, $this_op, '?');
+        }
+
         push @values, $value;
         return $sql;
     };