arching for Turkish characters didn't do case-insensitivity properly.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
return "LOWER($string)";
}
+sub sql_iposition {
+ my ($self, $fragment, $text) = @_;
+ $fragment = $self->sql_istring($fragment);
+ $text = $self->sql_istring($text);
+ return $self->sql_position($fragment, $text);
+}
+
sub sql_position {
my ($self, $fragment, $text) = @_;
=item B<Description>
-Outputs proper SQL syntax determinig position of a substring
+Outputs proper SQL syntax determining position of a substring
(fragment) withing a string (text). Note: if the substring or
text are string constants, they must be properly quoted (e.g. "'pattern'").
+It searches for the string in a case-sensitive manner. If you want to do
+a case-insensitive search, use L</sql_iposition>.
+
=item B<Params>
=over
=back
+=item C<sql_iposition>
+
+Just like L</sql_position>, but case-insensitive.
+
=item C<sql_group_by>
=over
return "INTERVAL $interval $units";
}
-sub sql_position {
+sub sql_iposition {
my ($self, $fragment, $text) = @_;
+ return "INSTR($text, $fragment)";
+}
- # mysql 4.0.1 and lower do not support CAST
- # (checksetup has a check for unsupported versions)
+sub sql_position {
+ my ($self, $fragment, $text) = @_;
- my $server_version = $self->bz_server_version;
return "INSTR(CAST($text AS BINARY), CAST($fragment AS BINARY))";
}
if ($word ne "") {
$sql_word = $dbh->quote($word);
trick_taint($sql_word);
- push(@list, $dbh->sql_position(lc($sql_word),
- "LOWER($field)") . " > 0");
+ push(@list, $dbh->sql_iposition($sql_word, $field) . " > 0");
}
}
my ($ff, $q, $term) = @func_args{qw(ff q term)};
my $dbh = Bugzilla->dbh;
- $$term = $dbh->sql_position(lc($$q), "LOWER($$ff)") . " > 0";
+ $$term = $dbh->sql_iposition($$q, $$ff) . " > 0";
}
sub _notsubstring {
my ($ff, $q, $term) = @func_args{qw(ff q term)};
my $dbh = Bugzilla->dbh;
- $$term = $dbh->sql_position(lc($$q), "LOWER($$ff)") . " = 0";
+ $$term = $dbh->sql_iposition($$q, $$ff) . " = 0";
}
sub _regexp {