Commit ddc96746 authored by David Taylor's avatar David Taylor Committed by Frédéric Buclin

Bug 780053: Oracle crashes when listing keywords, tags or flags in buglists

r/a=LpSolit
parent e377a5b0
...@@ -112,7 +112,8 @@ sub bz_explain { ...@@ -112,7 +112,8 @@ sub bz_explain {
sub sql_group_concat { sub sql_group_concat {
my ($self, $text, $separator) = @_; my ($self, $text, $separator) = @_;
$separator = $self->quote(', ') if !defined $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 { sub sql_regexp {
...@@ -527,14 +528,17 @@ sub bz_setup_database { ...@@ -527,14 +528,17 @@ sub bz_setup_database {
. " RETURN NUMBER IS BEGIN RETURN LENGTH(COLUMN_NAME); END;"); . " RETURN NUMBER IS BEGIN RETURN LENGTH(COLUMN_NAME); END;");
# Create types for group_concat # Create types for group_concat
my $t_clob_delim = $self->selectcol_arrayref(" $self->do("DROP TYPE T_GROUP_CONCAT");
SELECT TYPE_NAME FROM USER_TYPES WHERE TYPE_NAME=?", $self->do("CREATE OR REPLACE TYPE T_CLOB_DELIM AS OBJECT "
undef, 'T_CLOB_DELIM'); . "( p_CONTENT CLOB, p_DELIMITER VARCHAR2(256)"
. ", MAP MEMBER FUNCTION T_CLOB_DELIM_ToVarchar return VARCHAR2"
if ( !@$t_clob_delim ) { . ");");
$self->do("CREATE OR REPLACE TYPE T_CLOB_DELIM AS OBJECT " $self->do("CREATE OR REPLACE TYPE BODY T_CLOB_DELIM IS
. "( p_CONTENT CLOB, p_DELIMITER VARCHAR2(256));"); 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 $self->do("CREATE OR REPLACE TYPE T_GROUP_CONCAT AS OBJECT
( CLOB_CONTENT CLOB, ( CLOB_CONTENT CLOB,
......
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