diff options
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 10 | ||||
-rw-r--r-- | Bugzilla/DB/Oracle.pm | 12 | ||||
-rw-r--r-- | Bugzilla/DB/Pg.pm | 10 |
3 files changed, 19 insertions, 13 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 92263af9d..c9a80a93d 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -136,17 +136,19 @@ sub sql_group_concat { } sub sql_regexp { - my ($self, $expr, $pattern, $nocheck) = @_; + my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; + $real_pattern ||= $pattern; - $self->bz_check_regexp($pattern) if !$nocheck; + $self->bz_check_regexp($real_pattern) if !$nocheck; return "$expr REGEXP $pattern"; } sub sql_not_regexp { - my ($self, $expr, $pattern, $nocheck) = @_; + my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; + $real_pattern ||= $pattern; - $self->bz_check_regexp($pattern) if !$nocheck; + $self->bz_check_regexp($real_pattern) if !$nocheck; return "$expr NOT REGEXP $pattern"; } diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 854b72a43..833fce635 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -99,7 +99,7 @@ sub bz_check_regexp { my ($self, $pattern) = @_; eval { $self->do("SELECT 1 FROM DUAL WHERE " - . $self->sql_regexp($self->quote("a"), $self->quote($pattern), 1)) }; + . $self->sql_regexp($self->quote("a"), $pattern, 1)) }; $@ && ThrowUserError('illegal_regexp', { value => $pattern, dberror => $self->errstr }); @@ -115,17 +115,19 @@ sub bz_explain { } sub sql_regexp { - my ($self, $expr, $pattern, $nocheck) = @_; + my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; + $real_pattern ||= $pattern; - $self->bz_check_regexp($pattern) if !$nocheck; + $self->bz_check_regexp($real_pattern) if !$nocheck; return "REGEXP_LIKE($expr, $pattern)"; } sub sql_not_regexp { - my ($self, $expr, $pattern, $nocheck) = @_; + my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; + $real_pattern ||= $pattern; - $self->bz_check_regexp($pattern) if !$nocheck; + $self->bz_check_regexp($real_pattern) if !$nocheck; return "NOT REGEXP_LIKE($expr, $pattern)" } diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index d06decaa3..66ad4b1ec 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -93,17 +93,19 @@ sub bz_last_key { } sub sql_regexp { - my ($self, $expr, $pattern, $nocheck) = @_; + my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; + $real_pattern ||= $pattern; - $self->bz_check_regexp($pattern) if !$nocheck; + $self->bz_check_regexp($real_pattern) if !$nocheck; return "$expr ~* $pattern"; } sub sql_not_regexp { - my ($self, $expr, $pattern, $nocheck) = @_; + my ($self, $expr, $pattern, $nocheck, $real_pattern) = @_; + $real_pattern ||= $pattern; - $self->bz_check_regexp($pattern) if !$nocheck; + $self->bz_check_regexp($real_pattern) if !$nocheck; return "$expr !~* $pattern" } |