]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove order from groupConcat as it is not working everywhere
authorJoas Schilling <coding@schilljs.com>
Mon, 17 Jan 2022 10:58:50 +0000 (11:58 +0100)
committerVitor Mattos <vitor@php.rio>
Fri, 21 Jan 2022 11:39:39 +0000 (08:39 -0300)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Comments/Manager.php
lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php
lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php
lib/private/DB/QueryBuilder/FunctionBuilder/PgSqlFunctionBuilder.php
lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
lib/public/DB/QueryBuilder/IFunctionBuilder.php

index 95fb7f24e53f98a13ed61adcfe6d7e42361fcd84..a4afffe2cd446e268898af6ec3f03557b58c5fe2 100644 (file)
@@ -1233,7 +1233,7 @@ class Manager implements ICommentsManager {
                        ->selectAlias(
                                $jsonQuery->func()->concat(
                                        $jsonQuery->expr()->literal('{'),
-                                       $jsonQuery->func()->groupConcat('colonseparatedvalue', ','),
+                                       $jsonQuery->func()->groupConcat('colonseparatedvalue'),
                                        $jsonQuery->expr()->literal('}')
                                ),
                                'json'
index ba59f42ce5dc9c51eb8610c76403410943c64859..03630ea14a370f3db4e66f1c7eaab97f14e49231 100644 (file)
@@ -59,7 +59,7 @@ class FunctionBuilder implements IFunctionBuilder {
                return new QueryFunction(sprintf('CONCAT(%s)', implode(', ', $list)));
        }
 
-       public function groupConcat($expr, ?string $separator = ',', ?string $orderBy = null): IQueryFunction {
+       public function groupConcat($expr, ?string $separator = ','): IQueryFunction {
                $separator = $this->connection->quote($separator);
                return new QueryFunction('GROUP_CONCAT(' . $this->helper->quoteColumnName($expr) . ' SEPARATOR ' . $separator . ')');
        }
index 77f14a2dda474f13d075ad370e3c8c2f4b0c0463..43ecf599eba0cc665d4db1624acbdeb6617b8448 100644 (file)
@@ -82,8 +82,8 @@ class OCIFunctionBuilder extends FunctionBuilder {
                return new QueryFunction(sprintf('(%s)', implode(' || ', $list)));
        }
 
-       public function groupConcat($expr, ?string $separator = ',', ?string $orderBy = 'NULL'): IQueryFunction {
-               $orderByClause = ' WITHIN GROUP(ORDER BY ' . $orderBy . ')';
+       public function groupConcat($expr, ?string $separator = ','): IQueryFunction {
+               $orderByClause = ' WITHIN GROUP(ORDER BY NULL)';
                if (is_null($separator)) {
                        return new QueryFunction('LISTAGG(' . $this->helper->quoteColumnName($expr) . ')' . $orderByClause);
                }
index 3a1d9a56734c7b260a04d328e2e310f9f52d75de..444f6aa83a4e4df5a2376d6fe14d91137a6705df 100644 (file)
@@ -37,7 +37,7 @@ class PgSqlFunctionBuilder extends FunctionBuilder {
                return new QueryFunction(sprintf('(%s)', implode(' || ', $list)));
        }
 
-       public function groupConcat($expr, ?string $separator = ',', ?string $orderBy = null): IQueryFunction {
+       public function groupConcat($expr, ?string $separator = ','): IQueryFunction {
                $castedExpression = $this->queryBuilder->expr()->castColumn($expr, IQueryBuilder::PARAM_STR);
 
                if (is_null($separator)) {
index cfcabc9eb1ad4a6ef0332d8625532547704c7f8d..fe700075a82c308ac9b3f1c0bc2316522f2561f1 100644 (file)
@@ -36,7 +36,7 @@ class SqliteFunctionBuilder extends FunctionBuilder {
                return new QueryFunction(sprintf('(%s)', implode(' || ', $list)));
        }
 
-       public function groupConcat($expr, ?string $separator = ',', ?string $orderBy = null): IQueryFunction {
+       public function groupConcat($expr, ?string $separator = ','): IQueryFunction {
                $separator = $this->connection->quote($separator);
                return new QueryFunction('GROUP_CONCAT(' . $this->helper->quoteColumnName($expr) . ', ' . $separator . ')');
        }
index 9b0c7254250e119238dcaea3c28569db5b7ab116..04c5cbd07bde6b7227105cffff22555bd8bf85c9 100644 (file)
@@ -62,11 +62,10 @@ interface IFunctionBuilder {
         *
         * @param string|IQueryFunction $expr The expression to group
         * @param string|null $separator The separator
-        * @param string|null $orderBy Option only used to make compatible with Oracle database if is necessary use order. The default value is null and the Oracle don't will respect the order by of query
         * @return IQueryFunction
         * @since 24.0.0
         */
-       public function groupConcat($expr, ?string $separator = ',', ?string $orderBy = null): IQueryFunction;
+       public function groupConcat($expr, ?string $separator = ','): IQueryFunction;
 
        /**
         * Takes a substring from the input string