summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authorDavid Taylor <davidt@yadt.co.uk>2012-10-19 01:05:49 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-10-19 01:05:49 +0200
commitddc967463fa77bd756601fbe23b1439f2c88ac79 (patch)
tree0a5ad75347026c7024385cba13c34eb7574fc050 /Bugzilla/DB
parente377a5b02799540d3a9df0fbb1f6fae90f8d9a5c (diff)
downloadbugzilla-ddc967463fa77bd756601fbe23b1439f2c88ac79.tar.gz
bugzilla-ddc967463fa77bd756601fbe23b1439f2c88ac79.tar.xz
Bug 780053: Oracle crashes when listing keywords, tags or flags in buglists
r/a=LpSolit
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Oracle.pm22
1 files changed, 13 insertions, 9 deletions
diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm
index 3f7bc2b87..e6beef5cc 100644
--- a/Bugzilla/DB/Oracle.pm
+++ b/Bugzilla/DB/Oracle.pm
@@ -112,7 +112,8 @@ sub bz_explain {
sub sql_group_concat {
my ($self, $text, $separator) = @_;
$separator = $self->quote(', ') if !defined $separator;
- return "group_concat(T_CLOB_DELIM($text, $separator))";
+ my ($distinct, $rest) = $text =~/^(\s*DISTINCT\s|)(.+)$/i;
+ return "group_concat($distinct T_CLOB_DELIM(NVL($rest, ' '), $separator))";
}
sub sql_regexp {
@@ -527,14 +528,17 @@ sub bz_setup_database {
. " RETURN NUMBER IS BEGIN RETURN LENGTH(COLUMN_NAME); END;");
# Create types for group_concat
- my $t_clob_delim = $self->selectcol_arrayref("
- SELECT TYPE_NAME FROM USER_TYPES WHERE TYPE_NAME=?",
- undef, 'T_CLOB_DELIM');
-
- if ( !@$t_clob_delim ) {
- $self->do("CREATE OR REPLACE TYPE T_CLOB_DELIM AS OBJECT "
- . "( p_CONTENT CLOB, p_DELIMITER VARCHAR2(256));");
- }
+ $self->do("DROP TYPE T_GROUP_CONCAT");
+ $self->do("CREATE OR REPLACE TYPE T_CLOB_DELIM AS OBJECT "
+ . "( p_CONTENT CLOB, p_DELIMITER VARCHAR2(256)"
+ . ", MAP MEMBER FUNCTION T_CLOB_DELIM_ToVarchar return VARCHAR2"
+ . ");");
+ $self->do("CREATE OR REPLACE TYPE BODY T_CLOB_DELIM IS
+ MAP MEMBER FUNCTION T_CLOB_DELIM_ToVarchar return VARCHAR2 is
+ BEGIN
+ RETURN p_CONTENT;
+ END;
+ END;");
$self->do("CREATE OR REPLACE TYPE T_GROUP_CONCAT AS OBJECT
( CLOB_CONTENT CLOB,