diff options
Diffstat (limited to 'lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php')
-rw-r--r-- | lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php index af72d85d511..d3553565b7e 100644 --- a/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php +++ b/lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php @@ -73,10 +73,14 @@ class OCIFunctionBuilder extends FunctionBuilder { return parent::least($x, $y); } - public function groupConcat($expr, ?string $separator = ','): IQueryFunction { + public function groupConcat($expr, ?string $separator = ',', ?string $orderBy = null): IQueryFunction { + if (is_null($orderBy)) { + $orderBy = 'NULL'; + } + $orderByClause = ' WITHIN GROUP(ORDER BY ' . $orderBy . ')'; if (is_null($separator)) { - return new QueryFunction('LISTAGG(' . $this->helper->quoteColumnName($expr)); + return new QueryFunction('LISTAGG(' . $this->helper->quoteColumnName($expr) . $orderByClause . ')'); } - return new QueryFunction('LISTAGG(' . $this->helper->quoteColumnName($expr) . ", '$separator')"); + return new QueryFunction('LISTAGG(' . $this->helper->quoteColumnName($expr) . ", '$separator')$orderByClause"); } } |