]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 455857: [Oracle] 'Find a Specific Bug' doesn't work - Patch by Xiaoou <xiaoou...
authorlpsolit%gmail.com <>
Fri, 17 Oct 2008 18:36:01 +0000 (18:36 +0000)
committerlpsolit%gmail.com <>
Fri, 17 Oct 2008 18:36:01 +0000 (18:36 +0000)
Bugzilla/DB.pm
Bugzilla/DB/Oracle.pm
Bugzilla/Search.pm

index 12a19d2905efbbcfc3c8856f1c7584404daedd97..d68c5dc4b9edfbb46fa10d4011ce5e641b9c2894 100644 (file)
@@ -52,6 +52,7 @@ use Storable qw(dclone);
 
 use constant BLOB_TYPE => DBI::SQL_BLOB;
 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
 # are no longer stored in localconfig.  If we are upgrading from a
index b785b08d7d9a2f4d47f23fec0f03a4213ae71063..b5fd48b289ab0eb3fb48b767dabf7d4ed56a52ab 100644 (file)
@@ -52,6 +52,7 @@ use base qw(Bugzilla::DB);
 use constant EMPTY_STRING  => '__BZ_EMPTY_STR__';
 use constant ISOLATION_LEVEL => 'READ COMMITTED';
 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 {
     my ($class, $user, $pass, $host, $dbname, $port) = @_;
@@ -80,7 +81,7 @@ sub new {
     $self->do("ALTER SESSION SET NLS_LENGTH_SEMANTICS='CHAR'") 
         if Bugzilla->params->{'utf8'};
     # 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'");
     return $self;
 }
index 83c8e91a3049393ad8d6ae65a95c839ea6bab212..fb4ab05738fbfafa7d4b58e323c92b0dcf0eb22a 100644 (file)
@@ -801,8 +801,10 @@ sub init {
                  $field =~ /^(relevance|actual_time|percentage_complete)/);
         # The structure of fields is of the form:
         # [foo AS] {bar | bar.baz} [ASC | DESC]
-        # Only the mandatory part bar OR bar.baz is of interest
-        if ($field =~ /(?:.*\s+AS\s+)?(\w+(\.\w+)?)(?:\s+(ASC|DESC))?$/i) {
+        # Only the mandatory part bar OR bar.baz is of interest.
+        # 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);
         }
     }