313
return "LOWER($string)";
313
return "LOWER($string)";
317
my ($self, $fragment, $text) = @_;
318
$fragment = $self->sql_istring($fragment);
319
$text = $self->sql_istring($text);
320
return $self->sql_position($fragment, $text);
316
sub sql_position {
323
sub sql_position {
317
my ($self, $fragment, $text) = @_;
324
my ($self, $fragment, $text) = @_;
1700
=item B<Description>
1707
=item B<Description>
1702
Outputs proper SQL syntax determinig position of a substring
1709
Outputs proper SQL syntax determining position of a substring
1703
(fragment) withing a string (text). Note: if the substring or
1710
(fragment) withing a string (text). Note: if the substring or
1704
text are string constants, they must be properly quoted (e.g. "'pattern'").
1711
text are string constants, they must be properly quoted (e.g. "'pattern'").
1713
It searches for the string in a case-sensitive manner. If you want to do
1714
a case-insensitive search, use L</sql_iposition>.
1706
=item B<Params>
1716
=item B<Params>
1732
=item C<sql_iposition>
1734
Just like L</sql_position>, but case-insensitive.
1722
=item C<sql_group_by>
1736
=item C<sql_group_by>
183
return "INTERVAL $interval $units";
183
return "INTERVAL $interval $units";
187
my ($self, $fragment, $text) = @_;
188
return "INSTR($text, $fragment)";
186
sub sql_position {
191
sub sql_position {
187
my ($self, $fragment, $text) = @_;
192
my ($self, $fragment, $text) = @_;
189
# mysql 4.0.1 and lower do not support CAST
190
# (checksetup has a check for unsupported versions)
192
my $server_version = $self->bz_server_version;
193
return "INSTR(CAST($text AS BINARY), CAST($fragment AS BINARY))";
194
return "INSTR(CAST($text AS BINARY), CAST($fragment AS BINARY))";
912
if ($word ne "") {
912
if ($word ne "") {
913
$sql_word = $dbh->quote($word);
913
$sql_word = $dbh->quote($word);
914
trick_taint($sql_word);
914
trick_taint($sql_word);
915
push(@list, $dbh->sql_position(lc($sql_word),
915
push(@list, $dbh->sql_iposition($sql_word, $field) . " > 0");
916
"LOWER($field)") . " > 0");
1919
my ($ff, $q, $term) = @func_args{qw(ff q term)};
1918
my ($ff, $q, $term) = @func_args{qw(ff q term)};
1920
my $dbh = Bugzilla->dbh;
1919
my $dbh = Bugzilla->dbh;
1922
$$term = $dbh->sql_position(lc($$q), "LOWER($$ff)") . " > 0";
1921
$$term = $dbh->sql_iposition($$q, $$ff) . " > 0";
1925
sub _notsubstring {
1924
sub _notsubstring {
1928
my ($ff, $q, $term) = @func_args{qw(ff q term)};
1927
my ($ff, $q, $term) = @func_args{qw(ff q term)};
1929
my $dbh = Bugzilla->dbh;
1928
my $dbh = Bugzilla->dbh;
1931
$$term = $dbh->sql_position(lc($$q), "LOWER($$ff)") . " = 0";
1930
$$term = $dbh->sql_iposition($$q, $$ff) . " = 0";
1934
sub _regexp {
1933
sub _regexp {