summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index ccd86d781..6043aee00 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -397,8 +397,11 @@ sub sql_string_concat {
sub sql_string_until {
my ($self, $string, $substring) = @_;
- return "SUBSTRING($string FROM 1 FOR " .
- $self->sql_position($substring, $string) . " - 1)";
+
+ my $position = $self->sql_position($substring, $string);
+ return "CASE WHEN $position != 0"
+ . " THEN SUBSTR($string, 1, $position - 1)"
+ . " ELSE $string END";
}
sub sql_in {