]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 284599: Use of REGEXP search is not consistent wrt case sensitivity
authormkanat%kerio.com <>
Wed, 20 Apr 2005 06:44:03 +0000 (06:44 +0000)
committermkanat%kerio.com <>
Wed, 20 Apr 2005 06:44:03 +0000 (06:44 +0000)
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=justdave

Bugzilla/DB.pm
Bugzilla/DB/Pg.pm
Bugzilla/Search.pm

index 7e45e56e4560179937395046c1df86f85ac1dfd9..f1747b39da4c83ea88df585231d63f94b40362f0 100644 (file)
@@ -1199,7 +1199,8 @@ formatted SQL command have prefix C<sql_>. All other methods have prefix C<bz_>.
 =item C<sql_regexp>
 
  Description: Outputs SQL regular expression operator for POSIX regex
-              searches in format suitable for a given database.
+              searches (case insensitive) in format suitable for a given
+              database.
               Abstract method, should be overriden by database specific code.
  Params:      none
  Returns:     formatted SQL for regular expression search (e.g. REGEXP)
@@ -1208,7 +1209,8 @@ formatted SQL command have prefix C<sql_>. All other methods have prefix C<bz_>.
 =item C<sql_not_regexp>
 
  Description: Outputs SQL regular expression operator for negative POSIX
-              regex searches in format suitable for a given database.
+              regex searches (case insensitive) in format suitable for a given
+              database.
               Abstract method, should be overriden by database specific code.
  Params:      none
  Returns:     formatted SQL for negative regular expression search
index e635096f22ca10cc461449c756e3eb0cd70de5f9..4fe8d2244fd5f43a30bbbb0af010fead6fc236e5 100644 (file)
@@ -87,11 +87,11 @@ sub bz_last_key {
 }
 
 sub sql_regexp {
-    return "~";
+    return "~*";
 }
 
 sub sql_not_regexp {
-    return "!~" 
+    return "!~*
 }
 
 sub sql_limit {
index bebbfd94a5377533410343c6eaf1336f4ac25b67..b12d714f9c7ca885b68c27fc2488ff12051537f2 100644 (file)
@@ -1000,10 +1000,10 @@ sub init {
              $term = $dbh->sql_position(lc($q), "LOWER($ff)") . " = 0";
          },
          ",regexp" => sub {
-             $term = "LOWER($ff) " . $dbh->sql_regexp() . " $q";
+             $term = "$ff " . $dbh->sql_regexp() . " $q";
          },
          ",notregexp" => sub {
-             $term = "LOWER($ff) " . $dbh->sql_not_regexp() . " $q";
+             $term = "$ff " . $dbh->sql_not_regexp() . " $q";
          },
          ",lessthan" => sub {
              $term = "$ff < $q";
@@ -1506,7 +1506,7 @@ sub GetByWordList {
             $word =~ s/^'//;
             $word =~ s/'$//;
             $word = '(^|[^a-z0-9])' . $word . '($|[^a-z0-9])';
-            push(@list, "lower($field) " . $dbh->sql_regexp() . " '$word'");
+            push(@list, "$field " . $dbh->sql_regexp() . " '$word'");
         }
     }