summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 377f83930..81a720ee5 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -342,6 +342,12 @@ sub sql_string_concat {
return '(' . join(' || ', @params) . ')';
}
+sub sql_string_until {
+ my ($self, $string, $substring) = @_;
+ return "SUBSTRING($string FROM 1 FOR " .
+ $self->sql_position($substring, $string) . " - 1)";
+}
+
sub sql_in {
my ($self, $column_name, $in_list_ref) = @_;
return " $column_name IN (" . join(',', @$in_list_ref) . ") ";
@@ -1811,6 +1817,25 @@ Formatted SQL for concatenating specified strings
=back
+=item C<sql_string_until>
+
+=over
+
+=item B<Description>
+
+Returns SQL for truncating a string at the first occurrence of a certain
+substring.
+
+=item B<Params>
+
+Note that both parameters need to be sql-quoted.
+
+=item C<$string> The string we're truncating
+
+=item C<$substring> The substring we're truncating at.
+
+=back
+
=item C<sql_fulltext_search>
=over