Close open cursors

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2021-04-23 11:47:39 +02:00
parent 72a4f21efe
commit 323f95693c
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 5 additions and 3 deletions

View File

@ -1894,8 +1894,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid))); ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid)));
$stmt = $query->executeQuery(); $stmt = $query->executeQuery();
$row = $stmt->fetch();
if ($row = $stmt->fetch()) { $stmt->closeCursor();
if ($row) {
return $row['calendaruri'] . '/' . $row['objecturi']; return $row['calendaruri'] . '/' . $row['objecturi'];
} }
@ -2000,7 +2001,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
// Fetching all changes // Fetching all changes
$stmt = $qb->executeQuery(); $stmt = $qb->executeQuery();
$changes = []; $changes = [];
// This loop ensures that any duplicates are overwritten, only the // This loop ensures that any duplicates are overwritten, only the
@ -2008,6 +2008,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
while ($row = $stmt->fetch()) { while ($row = $stmt->fetch()) {
$changes[$row['uri']] = $row['operation']; $changes[$row['uri']] = $row['operation'];
} }
$stmt->closeCursor();
foreach ($changes as $uri => $operation) { foreach ($changes as $uri => $operation) {
switch ($operation) { switch ($operation) {
@ -2035,6 +2036,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
); );
$stmt = $qb->executeQuery(); $stmt = $qb->executeQuery();
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
$stmt->closeCursor();
} }
return $result; return $result;
} }