diff options
Diffstat (limited to 'Bugzilla/DB/Mysql.pm')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 4b90a2a34..7f3eb2ef8 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -126,12 +126,15 @@ sub bz_last_key { } sub sql_group_concat { - my ($self, $column, $separator) = @_; - my $sep_sql; - if ($separator) { - $sep_sql = " SEPARATOR $separator"; + my ($self, $column, $separator, $sort) = @_; + $separator = $self->quote(', ') if !defined $separator; + $sort = 1 if !defined $sort; + if ($sort) { + my $sort_order = $column; + $sort_order =~ s/^DISTINCT\s+//i; + $column = "$column ORDER BY $sort_order"; } - return "GROUP_CONCAT($column$sep_sql)"; + return "GROUP_CONCAT($column SEPARATOR $separator)"; } sub sql_regexp { |