Commit 3f8fe270 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 455857: [Oracle] 'Find a Specific Bug' doesn't work - Patch by Xiaoou…

Bug 455857: [Oracle] 'Find a Specific Bug' doesn't work - Patch by Xiaoou <xiaoou.wu@oracle.com> r/a=mkanat
parent 50035ffc
...@@ -52,6 +52,7 @@ use Storable qw(dclone); ...@@ -52,6 +52,7 @@ use Storable qw(dclone);
use constant BLOB_TYPE => DBI::SQL_BLOB; use constant BLOB_TYPE => DBI::SQL_BLOB;
use constant ISOLATION_LEVEL => 'REPEATABLE READ'; use constant ISOLATION_LEVEL => 'REPEATABLE READ';
use constant GROUPBY_REGEXP => '(?:.*\s+AS\s+)?(\w+(\.\w+)?)(?:\s+(ASC|DESC))?$';
# Set default values for what used to be the enum types. These values # Set default values for what used to be the enum types. These values
# are no longer stored in localconfig. If we are upgrading from a # are no longer stored in localconfig. If we are upgrading from a
......
...@@ -52,6 +52,7 @@ use base qw(Bugzilla::DB); ...@@ -52,6 +52,7 @@ use base qw(Bugzilla::DB);
use constant EMPTY_STRING => '__BZ_EMPTY_STR__'; use constant EMPTY_STRING => '__BZ_EMPTY_STR__';
use constant ISOLATION_LEVEL => 'READ COMMITTED'; use constant ISOLATION_LEVEL => 'READ COMMITTED';
use constant BLOB_TYPE => { ora_type => ORA_BLOB }; use constant BLOB_TYPE => { ora_type => ORA_BLOB };
use constant GROUPBY_REGEXP => '((CASE\s+WHEN.+END)|(TO_CHAR\(.+\))|(\(SCORE.+\))|(\(MATCH.+\))|(\w+(\.\w+)?))(\s+AS\s+)?(.*)?$';
sub new { sub new {
my ($class, $user, $pass, $host, $dbname, $port) = @_; my ($class, $user, $pass, $host, $dbname, $port) = @_;
...@@ -80,7 +81,7 @@ sub new { ...@@ -80,7 +81,7 @@ sub new {
$self->do("ALTER SESSION SET NLS_LENGTH_SEMANTICS='CHAR'") $self->do("ALTER SESSION SET NLS_LENGTH_SEMANTICS='CHAR'")
if Bugzilla->params->{'utf8'}; if Bugzilla->params->{'utf8'};
# To allow case insensitive query. # To allow case insensitive query.
$self->do("ALTER SESSION SET NLS_COMP='LINGUISTIC'"); $self->do("ALTER SESSION SET NLS_COMP='ANSI'");
$self->do("ALTER SESSION SET NLS_SORT='BINARY_AI'"); $self->do("ALTER SESSION SET NLS_SORT='BINARY_AI'");
return $self; return $self;
} }
......
...@@ -802,8 +802,10 @@ sub init { ...@@ -802,8 +802,10 @@ sub init {
$field =~ /^(relevance|actual_time|percentage_complete)/); $field =~ /^(relevance|actual_time|percentage_complete)/);
# The structure of fields is of the form: # The structure of fields is of the form:
# [foo AS] {bar | bar.baz} [ASC | DESC] # [foo AS] {bar | bar.baz} [ASC | DESC]
# Only the mandatory part bar OR bar.baz is of interest # Only the mandatory part bar OR bar.baz is of interest.
if ($field =~ /(?:.*\s+AS\s+)?(\w+(\.\w+)?)(?:\s+(ASC|DESC))?$/i) { # But for Oracle, it needs the real name part instead.
my $regexp = $dbh->GROUPBY_REGEXP;
if ($field =~ /$regexp/i) {
push(@groupby, $1) if !grep($_ eq $1, @groupby); push(@groupby, $1) if !grep($_ eq $1, @groupby);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment