Commit db654f60 authored by mkanat%kerio.com's avatar mkanat%kerio.com

Bug 280495: Replace "REGEXP" with Bugzilla::DB function call

Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=wurblzap, a=myk
parent 62b2ec34
...@@ -95,6 +95,8 @@ sub init { ...@@ -95,6 +95,8 @@ sub init {
my @andlist; my @andlist;
my %chartfields; my %chartfields;
my $dbh = Bugzilla->dbh;
&::GetVersionTable(); &::GetVersionTable();
# First, deal with all the old hard-coded non-chart-based poop. # First, deal with all the old hard-coded non-chart-based poop.
...@@ -677,9 +679,9 @@ sub init { ...@@ -677,9 +679,9 @@ sub init {
} elsif ($t eq "notequal") { } elsif ($t eq "notequal") {
$oper = "<>"; $oper = "<>";
} elsif ($t eq "regexp") { } elsif ($t eq "regexp") {
$oper = "REGEXP"; $oper = $dbh->sql_regexp();
} elsif ($t eq "notregexp") { } elsif ($t eq "notregexp") {
$oper = "NOT REGEXP"; $oper = $dbh->sql_not_regexp();
} else { } else {
$oper = "noop"; $oper = "noop";
} }
...@@ -950,10 +952,10 @@ sub init { ...@@ -950,10 +952,10 @@ sub init {
$term = "INSTR(LOWER($ff), " . lc($q) . ") = 0"; $term = "INSTR(LOWER($ff), " . lc($q) . ") = 0";
}, },
",regexp" => sub { ",regexp" => sub {
$term = "LOWER($ff) REGEXP $q"; $term = "LOWER($ff) " . $dbh->sql_regexp() . " $q";
}, },
",notregexp" => sub { ",notregexp" => sub {
$term = "LOWER($ff) NOT REGEXP $q"; $term = "LOWER($ff) " . $dbh->sql_not_regexp() . " $q";
}, },
",lessthan" => sub { ",lessthan" => sub {
$term = "$ff < $q"; $term = "$ff < $q";
...@@ -1434,6 +1436,7 @@ sub build_subselect { ...@@ -1434,6 +1436,7 @@ sub build_subselect {
sub GetByWordList { sub GetByWordList {
my ($field, $strs) = (@_); my ($field, $strs) = (@_);
my @list; my @list;
my $dbh = Bugzilla->dbh;
foreach my $w (split(/[\s,]+/, $strs)) { foreach my $w (split(/[\s,]+/, $strs)) {
my $word = $w; my $word = $w;
...@@ -1443,7 +1446,7 @@ sub GetByWordList { ...@@ -1443,7 +1446,7 @@ sub GetByWordList {
$word =~ s/^'//; $word =~ s/^'//;
$word =~ s/'$//; $word =~ s/'$//;
$word = '(^|[^a-z0-9])' . $word . '($|[^a-z0-9])'; $word = '(^|[^a-z0-9])' . $word . '($|[^a-z0-9])';
push(@list, "lower($field) regexp '$word'"); push(@list, "lower($field) " . $dbh->sql_regexp() . " '$word'");
} }
} }
......
...@@ -260,7 +260,7 @@ my $action = trim($::FORM{action} || ''); ...@@ -260,7 +260,7 @@ my $action = trim($::FORM{action} || '');
my $localtrailer = '<a href="editusers.cgi?">edit more users</a>'; my $localtrailer = '<a href="editusers.cgi?">edit more users</a>';
my $candelete = Param('allowuserdeletion'); my $candelete = Param('allowuserdeletion');
my $dbh = Bugzilla->dbh;
# #
# action='' -> Ask for match string for users. # action='' -> Ask for match string for users.
...@@ -302,11 +302,11 @@ if ($action eq 'list') { ...@@ -302,11 +302,11 @@ if ($action eq 'list') {
$query .= "like"; $query .= "like";
$matchstr = '%' . $matchstr . '%'; $matchstr = '%' . $matchstr . '%';
} elsif ($::FORM{'matchtype'} eq 'regexp') { } elsif ($::FORM{'matchtype'} eq 'regexp') {
$query .= "regexp"; $query .= $dbh->sql_regexp();
$matchstr = '.' $matchstr = '.'
unless $matchstr; unless $matchstr;
} elsif ($::FORM{'matchtype'} eq 'notregexp') { } elsif ($::FORM{'matchtype'} eq 'notregexp') {
$query .= "not regexp"; $query .= $dbh->sql_not_regexp();
$matchstr = '.' $matchstr = '.'
unless $matchstr; unless $matchstr;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment