aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-01-14 15:56:47 -0300
committerVitor Mattos <vitor@php.rio>2022-01-21 08:39:39 -0300
commitf071b4dfbbd5fccae9b7b07b9a13ed71ddc91ce4 (patch)
tree3c9bbf05fd27336ccd763125c36c68e6ee1adf10 /lib/private/Comments
parentf7cd9956127be66dfd3141e1f05b6d3cfaceea05 (diff)
downloadnextcloud-server-f071b4dfbbd5fccae9b7b07b9a13ed71ddc91ce4.tar.gz
nextcloud-server-f071b4dfbbd5fccae9b7b07b9a13ed71ddc91ce4.zip
Fix groupConcat and ordering on Oracle
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/private/Comments')
-rw-r--r--lib/private/Comments/Manager.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 2e9acb6ca24..410fcf26f4d 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -1210,20 +1210,21 @@ class Manager implements ICommentsManager {
$totalQuery->expr()->literal('":'),
$totalQuery->func()->count('id')
),
- 'total'
+ 'colonseparatedvalue'
)
+ ->selectAlias($totalQuery->func()->count('id'), 'total')
->from('reactions', 'r')
->where($totalQuery->expr()->eq('r.parent_id', $qb->createNamedParameter($parentId)))
->groupBy('r.reaction')
- ->orderBy($totalQuery->func()->count('id'), 'DESC')
+ ->orderBy('total', 'DESC')
->setMaxResults(200);
$jsonQuery = $this->dbConn->getQueryBuilder();
$jsonQuery
->selectAlias(
- $totalQuery->func()->concat(
+ $jsonQuery->func()->concat(
$jsonQuery->expr()->literal('{'),
- $jsonQuery->func()->groupConcat('total'),
+ $jsonQuery->func()->groupConcat('colonseparatedvalue', ',', $jsonQuery->getColumnName('total') . ' DESC'),
$jsonQuery->expr()->literal('}')
),
'json'