mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
fix(previews): fix chunking for querybuilder
Signed-off-by: Anna Larch <anna@nextcloud.com>
This commit is contained in:
parent
d56ad83c1c
commit
59144ace90
1 changed files with 20 additions and 24 deletions
|
|
@ -310,20 +310,18 @@ class LocalPreviewStorage implements IPreviewStorage {
|
|||
}
|
||||
|
||||
$result = [];
|
||||
$qb = $this->connection->getTypedQueryBuilder();
|
||||
$qb->selectColumns('fileid', 'storage', 'etag', 'mimetype')
|
||||
->from('filecache');
|
||||
foreach (array_chunk($fileIds, 1000) as $chunk) {
|
||||
$qb->andWhere(
|
||||
$qb->expr()->in('fileid', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY))
|
||||
);
|
||||
$qb = $this->connection->getTypedQueryBuilder();
|
||||
$qb->selectColumns('fileid', 'storage', 'etag', 'mimetype')
|
||||
->from('filecache')
|
||||
->where($qb->expr()->in('fileid', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$rows = $qb->runAcrossAllShards()
|
||||
->executeQuery();
|
||||
while ($row = $rows->fetchAssociative()) {
|
||||
$result[(int)$row['fileid']] = $row;
|
||||
}
|
||||
$rows->closeCursor();
|
||||
}
|
||||
$rows = $qb->runAcrossAllShards()
|
||||
->executeQuery();
|
||||
while ($row = $rows->fetchAssociative()) {
|
||||
$result[(int)$row['fileid']] = $row;
|
||||
}
|
||||
$rows->closeCursor();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
@ -338,20 +336,18 @@ class LocalPreviewStorage implements IPreviewStorage {
|
|||
}
|
||||
|
||||
$result = [];
|
||||
$qb = $this->connection->getTypedQueryBuilder();
|
||||
$qb->selectColumns('fileid', 'storage', 'etag', 'mimetype', 'parent', 'path_hash')
|
||||
->from('filecache');
|
||||
foreach (array_chunk($pathHashes, 1000) as $chunk) {
|
||||
$qb->andWhere(
|
||||
$qb->expr()->in('path_hash', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_STR_ARRAY))
|
||||
);
|
||||
$qb = $this->connection->getTypedQueryBuilder();
|
||||
$qb->selectColumns('fileid', 'storage', 'etag', 'mimetype', 'parent', 'path_hash')
|
||||
->from('filecache')
|
||||
->where($qb->expr()->in('path_hash', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$rows = $qb->runAcrossAllShards()
|
||||
->executeQuery();
|
||||
while ($row = $rows->fetchAssociative()) {
|
||||
$result[$row['path_hash']] = $row;
|
||||
}
|
||||
$rows->closeCursor();
|
||||
}
|
||||
$rows = $qb->runAcrossAllShards()
|
||||
->executeQuery();
|
||||
while ($row = $rows->fetchAssociative()) {
|
||||
$result[$row['path_hash']] = $row;
|
||||
}
|
||||
$rows->closeCursor();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue