Clean up cursor when done
parent
df2c448701
commit
df7866b876
|
@ -49,9 +49,11 @@ trait TimelineQueryDays {
|
||||||
private function getFilecacheJoinQuery(IQueryBuilder &$query, Folder &$folder, bool $recursive) {
|
private function getFilecacheJoinQuery(IQueryBuilder &$query, Folder &$folder, bool $recursive) {
|
||||||
// Subquery to get storage and path
|
// Subquery to get storage and path
|
||||||
$subQuery = $query->getConnection()->getQueryBuilder();
|
$subQuery = $query->getConnection()->getQueryBuilder();
|
||||||
$finfo = $subQuery->select('path', 'storage')->from('filecache')->where(
|
$cursor = $subQuery->select('path', 'storage')->from('filecache')->where(
|
||||||
$subQuery->expr()->eq('fileid', $subQuery->createNamedParameter($folder->getId())),
|
$subQuery->expr()->eq('fileid', $subQuery->createNamedParameter($folder->getId())),
|
||||||
)->executeQuery()->fetch();
|
)->executeQuery();
|
||||||
|
$finfo = $cursor->fetch();
|
||||||
|
$cursor->closeCursor();
|
||||||
if (empty($finfo)) {
|
if (empty($finfo)) {
|
||||||
throw new \Exception("Folder not found");
|
throw new \Exception("Folder not found");
|
||||||
}
|
}
|
||||||
|
@ -104,7 +106,9 @@ trait TimelineQueryDays {
|
||||||
$transform($query, $uid);
|
$transform($query, $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $query->executeQuery()->fetchAll();
|
$cursor = $query->executeQuery();
|
||||||
|
$rows = $cursor->fetchAll();
|
||||||
|
$cursor->closeCursor();
|
||||||
return $this->processDays($rows);
|
return $this->processDays($rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +147,9 @@ trait TimelineQueryDays {
|
||||||
$transform($query, $uid);
|
$transform($query, $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $query->executeQuery()->fetchAll();
|
$cursor = $query->executeQuery();
|
||||||
|
$rows = $cursor->fetchAll();
|
||||||
|
$cursor->closeCursor();
|
||||||
return $this->processDay($rows);
|
return $this->processDay($rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,9 @@ class TimelineWrite {
|
||||||
$query->select('fileid', 'mtime')
|
$query->select('fileid', 'mtime')
|
||||||
->from('memories')
|
->from('memories')
|
||||||
->where($query->expr()->eq('fileid', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)));
|
->where($query->expr()->eq('fileid', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)));
|
||||||
$prevRow = $query->executeQuery()->fetch();
|
$cursor = $query->executeQuery();
|
||||||
|
$prevRow = $cursor->fetch();
|
||||||
|
$cursor->closeCursor();
|
||||||
if ($prevRow && !$force && intval($prevRow['mtime']) === $mtime) {
|
if ($prevRow && !$force && intval($prevRow['mtime']) === $mtime) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue