]> source.dussan.org Git - nextcloud-server.git/commitdiff
Oracle does not support PDO::FETCH_KEY_PAIR
authorJoas Schilling <coding@schilljs.com>
Thu, 20 Jul 2017 18:13:35 +0000 (20:13 +0200)
committerJoas Schilling <coding@schilljs.com>
Thu, 3 Aug 2017 14:37:06 +0000 (16:37 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Comments/Manager.php

index f1c5b7dca500b9f3fd1fdbda0570da6c25a287b5..6a8e79b496be5845bc887178af7eb6114fa57465 100644 (file)
@@ -411,9 +411,12 @@ class Manager implements ICommentsManager {
         */
        public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) {
                $qb = $this->dbConn->getQueryBuilder();
-               $query = $qb->select('fileid', $qb->createFunction(
-                       'COUNT(' . $qb->getColumnName('c.id') . ')')
-               )->from('comments', 'c')
+               $query = $qb->select('fileid')
+                       ->selectAlias(
+                               $qb->createFunction('COUNT(' . $qb->getColumnName('c.id') . ')'),
+                               'num_ids'
+                       )
+                       ->from('comments', 'c')
                        ->innerJoin('c', 'filecache', 'f', $qb->expr()->andX(
                                $qb->expr()->eq('c.object_type', $qb->createNamedParameter('files')),
                                $qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT))
@@ -431,9 +434,13 @@ class Manager implements ICommentsManager {
                        ->groupBy('f.fileid');
 
                $resultStatement = $query->execute();
-               return array_map(function ($count) {
-                       return (int)$count;
-               }, $resultStatement->fetchAll(\PDO::FETCH_KEY_PAIR));
+
+               $results = [];
+               while ($row = $resultStatement->fetch()) {
+                       $results[$row['fileid']] = (int) $row['num_ids'];
+               }
+               $resultStatement->closeCursor();
+               return $results;
        }
 
        /**