diff options
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r-- | Bugzilla/DB.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index a537d6131..083a1c208 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 { |