Browse Source
Oracle does not support PDO::FETCH_KEY_PAIR
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/5816/head
Joas Schilling
8 years ago
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with
19 additions and
7 deletions
-
lib/private/Comments/Manager.php
-
lib/private/Files/Config/UserMountCache.php
|
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
@ -365,6 +365,11 @@ class UserMountCache implements IUserMountCache { |
|
|
|
|
|
|
|
$result = $query->execute(); |
|
|
|
|
|
|
|
return $result->fetchAll(\PDO::FETCH_KEY_PAIR); |
|
|
|
$results = []; |
|
|
|
while ($row = $result->fetch()) { |
|
|
|
$results[$row['user_id']] = $row['size']; |
|
|
|
} |
|
|
|
$result->closeCursor(); |
|
|
|
return $results; |
|
|
|
} |
|
|
|
} |