Use the new executeQuery and executeUpdate methods

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

View File

@ -255,7 +255,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
} }
$result = $query->execute(); $result = $query->executeQuery();
$column = (int)$result->fetchOne(); $column = (int)$result->fetchOne();
$result->closeCursor(); $result->closeCursor();
return $column; return $column;
@ -309,7 +309,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
} }
$result = $query->execute(); $result = $query->executeQuery();
$calendars = []; $calendars = [];
while ($row = $result->fetch()) { while ($row = $result->fetch()) {
@ -365,7 +365,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->setParameter('type', 'calendar') ->setParameter('type', 'calendar')
->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY); ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
$result = $query->execute(); $result = $query->executeQuery();
$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
while ($row = $result->fetch()) { while ($row = $result->fetch()) {
@ -437,7 +437,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->select($fields)->from('calendars') $query->select($fields)->from('calendars')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->orderBy('calendarorder', 'ASC'); ->orderBy('calendarorder', 'ASC');
$stmt = $query->execute(); $stmt = $query->executeQuery();
$calendars = []; $calendars = [];
while ($row = $stmt->fetch()) { while ($row = $stmt->fetch()) {
$row['principaluri'] = (string) $row['principaluri']; $row['principaluri'] = (string) $row['principaluri'];
@ -507,7 +507,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id')) ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
->execute(); ->executeQuery();
while ($row = $result->fetch()) { while ($row = $result->fetch()) {
$row['principaluri'] = (string) $row['principaluri']; $row['principaluri'] = (string) $row['principaluri'];
@ -567,7 +567,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC))) ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar'))) ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri))) ->andWhere($query->expr()->eq('s.publicuri', $query->createNamedParameter($uri)))
->execute(); ->executeQuery();
$row = $result->fetch(); $row = $result->fetch();
@ -626,7 +626,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->where($query->expr()->eq('uri', $query->createNamedParameter($uri))) ->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal))) ->andWhere($query->expr()->eq('principaluri', $query->createNamedParameter($principal)))
->setMaxResults(1); ->setMaxResults(1);
$stmt = $query->execute(); $stmt = $query->executeQuery();
$row = $stmt->fetch(); $row = $stmt->fetch();
$stmt->closeCursor(); $stmt->closeCursor();
@ -677,7 +677,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->select($fields)->from('calendars') $query->select($fields)->from('calendars')
->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))) ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)))
->setMaxResults(1); ->setMaxResults(1);
$stmt = $query->execute(); $stmt = $query->executeQuery();
$row = $stmt->fetch(); $row = $stmt->fetch();
$stmt->closeCursor(); $stmt->closeCursor();
@ -727,7 +727,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('calendarsubscriptions') ->from('calendarsubscriptions')
->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
->orderBy('calendarorder', 'asc'); ->orderBy('calendarorder', 'asc');
$stmt = $query->execute(); $stmt = $query->executeQuery();
$row = $stmt->fetch(); $row = $stmt->fetch();
$stmt->closeCursor(); $stmt->closeCursor();
@ -805,7 +805,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
foreach ($values as $column => $value) { foreach ($values as $column => $value) {
$query->setValue($column, $query->createNamedParameter($value)); $query->setValue($column, $query->createNamedParameter($value));
} }
$query->execute(); $query->executeUpdate();
$calendarId = $query->getLastInsertId(); $calendarId = $query->getLastInsertId();
$calendarData = $this->getCalendarById($calendarId); $calendarData = $this->getCalendarById($calendarId);
@ -860,7 +860,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->set($fieldName, $query->createNamedParameter($value)); $query->set($fieldName, $query->createNamedParameter($value));
} }
$query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); $query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
$query->execute(); $query->executeUpdate();
$this->addChange($calendarId, "", 2); $this->addChange($calendarId, "", 2);
@ -913,7 +913,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->delete($this->dbObjectPropertiesTable) $query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
->execute(); ->executeUpdate();
if ($calendarData) { if ($calendarData) {
$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares));
@ -968,7 +968,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('calendarobjects') ->from('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
$stmt = $query->execute(); $stmt = $query->executeQuery();
$result = []; $result = [];
foreach ($stmt->fetchAll() as $row) { foreach ($stmt->fetchAll() as $row) {
@ -1012,7 +1012,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
$stmt = $query->execute(); $stmt = $query->executeQuery();
$row = $stmt->fetch(); $row = $stmt->fetch();
$stmt->closeCursor(); $stmt->closeCursor();
@ -1063,7 +1063,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
foreach ($chunks as $uris) { foreach ($chunks as $uris) {
$query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY); $query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
$result = $query->execute(); $result = $query->executeQuery();
while ($row = $result->fetch()) { while ($row = $result->fetch()) {
$objects[] = [ $objects[] = [
@ -1113,7 +1113,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid']))) ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid'])))
->andWhere($q->expr()->eq('calendartype', $q->createNamedParameter($calendarType))); ->andWhere($q->expr()->eq('calendartype', $q->createNamedParameter($calendarType)));
$result = $q->execute(); $result = $q->executeQuery();
$count = (int) $result->fetchOne(); $count = (int) $result->fetchOne();
$result->closeCursor(); $result->closeCursor();
@ -1137,7 +1137,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'uid' => $query->createNamedParameter($extraData['uid']), 'uid' => $query->createNamedParameter($extraData['uid']),
'calendartype' => $query->createNamedParameter($calendarType), 'calendartype' => $query->createNamedParameter($calendarType),
]) ])
->execute(); ->executeUpdate();
$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
$this->addChange($calendarId, $objectUri, 1, $calendarType); $this->addChange($calendarId, $objectUri, 1, $calendarType);
@ -1210,7 +1210,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
->execute(); ->executeUpdate();
$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType); $this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
$this->addChange($calendarId, $objectUri, 2, $calendarType); $this->addChange($calendarId, $objectUri, 2, $calendarType);
@ -1264,7 +1264,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->update('calendarobjects') $query->update('calendarobjects')
->set('classification', $query->createNamedParameter($classification)) ->set('classification', $query->createNamedParameter($classification))
->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId))) ->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId)))
->execute(); ->executeUpdate();
} }
/** /**
@ -1420,7 +1420,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp()))); $query->andWhere($query->expr()->lt('firstoccurence', $query->createNamedParameter($timeRange['end']->getTimeStamp())));
} }
$stmt = $query->execute(); $stmt = $query->executeQuery();
$result = []; $result = [];
while ($row = $stmt->fetch()) { while ($row = $stmt->fetch()) {
@ -1565,7 +1565,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->setMaxResults($limit); $query->setMaxResults($limit);
} }
$stmt = $query->execute(); $stmt = $query->executeQuery();
$result = []; $result = [];
while ($row = $stmt->fetch()) { while ($row = $stmt->fetch()) {
@ -1654,7 +1654,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$outerQuery->setMaxResults($limit); $outerQuery->setMaxResults($limit);
} }
$result = $outerQuery->execute(); $result = $outerQuery->executeQuery();
$calendarObjects = $result->fetchAll(); $calendarObjects = $result->fetchAll();
return array_map(function ($o) { return array_map(function ($o) {
@ -1841,7 +1841,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendarObjectIdQuery->setFirstResult($options['offset']); $calendarObjectIdQuery->setFirstResult($options['offset']);
} }
$result = $calendarObjectIdQuery->execute(); $result = $calendarObjectIdQuery->executeQuery();
$matches = $result->fetchAll(); $matches = $result->fetchAll();
$result->closeCursor(); $result->closeCursor();
$matches = array_map(static function (array $match):int { $matches = array_map(static function (array $match):int {
@ -1853,7 +1853,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('calendarobjects') ->from('calendarobjects')
->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY))); ->where($query->expr()->in('id', $query->createNamedParameter($matches, IQueryBuilder::PARAM_INT_ARRAY)));
$result = $query->execute(); $result = $query->executeQuery();
$calendarObjects = $result->fetchAll(); $calendarObjects = $result->fetchAll();
$result->closeCursor(); $result->closeCursor();
@ -1893,7 +1893,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri))) ->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid))); ->andWhere($query->expr()->eq('co.uid', $query->createNamedParameter($uid)));
$stmt = $query->execute(); $stmt = $query->executeQuery();
if ($row = $stmt->fetch()) { if ($row = $stmt->fetch()) {
return $row['calendaruri'] . '/' . $row['objecturi']; return $row['calendaruri'] . '/' . $row['objecturi'];
@ -1967,7 +1967,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->where( ->where(
$qb->expr()->eq('id', $qb->createNamedParameter($calendarId)) $qb->expr()->eq('id', $qb->createNamedParameter($calendarId))
); );
$stmt = $qb->execute(); $stmt = $qb->executeQuery();
$currentToken = $stmt->fetchOne(); $currentToken = $stmt->fetchOne();
if ($currentToken === false) { if ($currentToken === false) {
@ -1999,7 +1999,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
} }
// Fetching all changes // Fetching all changes
$stmt = $qb->execute(); $stmt = $qb->executeQuery();
$changes = []; $changes = [];
@ -2033,7 +2033,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType)) $qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))
) )
); );
$stmt = $qb->execute(); $stmt = $qb->executeQuery();
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN); $result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
} }
return $result; return $result;
@ -2085,7 +2085,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('calendarsubscriptions') ->from('calendarsubscriptions')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->orderBy('calendarorder', 'asc'); ->orderBy('calendarorder', 'asc');
$stmt = $query->execute(); $stmt = $query->executeQuery();
$subscriptions = []; $subscriptions = [];
while ($row = $stmt->fetch()) { while ($row = $stmt->fetch()) {
@ -2156,7 +2156,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->insert('calendarsubscriptions') $query->insert('calendarsubscriptions')
->values($valuesToInsert) ->values($valuesToInsert)
->execute(); ->executeUpdate();
$subscriptionId = $query->getLastInsertId(); $subscriptionId = $query->getLastInsertId();
@ -2211,7 +2211,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->set($fieldName, $query->createNamedParameter($value)); $query->set($fieldName, $query->createNamedParameter($value));
} }
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) $query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
->execute(); ->executeUpdate();
$subscriptionRow = $this->getSubscriptionById($subscriptionId); $subscriptionRow = $this->getSubscriptionById($subscriptionId);
$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
@ -2246,23 +2246,23 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query = $this->db->getQueryBuilder(); $query = $this->db->getQueryBuilder();
$query->delete('calendarsubscriptions') $query->delete('calendarsubscriptions')
->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
->execute(); ->executeUpdate();
$query = $this->db->getQueryBuilder(); $query = $this->db->getQueryBuilder();
$query->delete('calendarobjects') $query->delete('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->execute(); ->executeUpdate();
$query->delete('calendarchanges') $query->delete('calendarchanges')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->execute(); ->executeUpdate();
$query->delete($this->dbObjectPropertiesTable) $query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->execute(); ->executeUpdate();
if ($subscriptionRow) { if ($subscriptionRow) {
$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
@ -2291,7 +2291,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('schedulingobjects') ->from('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->execute(); ->executeQuery();
$row = $stmt->fetch(); $row = $stmt->fetch();
@ -2324,7 +2324,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size']) $stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
->from('schedulingobjects') ->from('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->execute(); ->executeQuery();
$result = []; $result = [];
foreach ($stmt->fetchAll() as $row) { foreach ($stmt->fetchAll() as $row) {
@ -2352,7 +2352,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->delete('schedulingobjects') $query->delete('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->execute(); ->executeUpdate();
} }
/** /**
@ -2374,7 +2374,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'etag' => $query->createNamedParameter(md5($objectData)), 'etag' => $query->createNamedParameter(md5($objectData)),
'size' => $query->createNamedParameter(strlen($objectData)) 'size' => $query->createNamedParameter(strlen($objectData))
]) ])
->execute(); ->executeUpdate();
} }
/** /**
@ -2393,7 +2393,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->select('synctoken') $query->select('synctoken')
->from($table) ->from($table)
->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
$result = $query->execute(); $result = $query->executeQuery();
$syncToken = (int)$result->fetchOne(); $syncToken = (int)$result->fetchOne();
$result->closeCursor(); $result->closeCursor();
@ -2406,7 +2406,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'operation' => $query->createNamedParameter($operation), 'operation' => $query->createNamedParameter($operation),
'calendartype' => $query->createNamedParameter($calendarType), 'calendartype' => $query->createNamedParameter($calendarType),
]) ])
->execute(); ->executeUpdate();
$stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?"); $stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?");
$stmt->execute([ $stmt->execute([
@ -2589,7 +2589,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'resourceid' => $query->createNamedParameter($calendar->getResourceId()), 'resourceid' => $query->createNamedParameter($calendar->getResourceId()),
'publicuri' => $query->createNamedParameter($publicUri) 'publicuri' => $query->createNamedParameter($publicUri)
]); ]);
$query->execute(); $query->executeUpdate();
$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
return $publicUri; return $publicUri;
@ -2597,7 +2597,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->delete('dav_shares') $query->delete('dav_shares')
->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
$query->execute(); $query->executeUpdate();
$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
return null; return null;
@ -2613,7 +2613,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('dav_shares') ->from('dav_shares')
->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
->execute(); ->executeQuery();
$row = $result->fetch(); $row = $result->fetch();
$result->closeCursor(); $result->closeCursor();
@ -2681,7 +2681,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->setParameter('name', $property->name); $query->setParameter('name', $property->name);
$query->setParameter('parameter', null); $query->setParameter('parameter', null);
$query->setParameter('value', $value); $query->setParameter('value', $value);
$query->execute(); $query->executeUpdate();
} }
if (array_key_exists($property->name, self::$indexParameters)) { if (array_key_exists($property->name, self::$indexParameters)) {
@ -2698,7 +2698,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->setParameter('name', $property->name); $query->setParameter('name', $property->name);
$query->setParameter('parameter', mb_substr($key, 0, 254)); $query->setParameter('parameter', mb_substr($key, 0, 254));
$query->setParameter('value', mb_substr($value, 0, 254)); $query->setParameter('value', mb_substr($value, 0, 254));
$query->execute(); $query->executeUpdate();
} }
} }
} }
@ -2713,7 +2713,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query = $this->db->getQueryBuilder(); $query = $this->db->getQueryBuilder();
$result = $query->select(['id'])->from('calendars') $result = $query->select(['id'])->from('calendars')
->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)))
->execute(); ->executeQuery();
$ids = $result->fetchAll(); $ids = $result->fetchAll();
foreach ($ids as $id) { foreach ($ids as $id) {
@ -2730,7 +2730,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('calendarobjects') ->from('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
$stmt = $query->execute(); $stmt = $query->executeQuery();
$uris = []; $uris = [];
foreach ($stmt->fetchAll() as $row) { foreach ($stmt->fetchAll() as $row) {
@ -2742,17 +2742,17 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->delete('calendarobjects') $query->delete('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->execute(); ->executeUpdate();
$query->delete('calendarchanges') $query->delete('calendarchanges')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->execute(); ->executeUpdate();
$query->delete($this->dbObjectPropertiesTable) $query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId))) ->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))) ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->execute(); ->executeUpdate();
foreach ($uris as $uri) { foreach ($uris as $uri) {
$this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION); $this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
@ -2774,7 +2774,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->set('uri', $query->createNamedParameter($newUriName ?: $uriName)) ->set('uri', $query->createNamedParameter($newUriName ?: $uriName))
->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin))) ->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName))) ->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName)))
->execute(); ->executeUpdate();
} }
/** /**
@ -2798,7 +2798,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$query->delete($this->dbObjectPropertiesTable) $query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId))) ->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId)))
->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))); ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
$query->execute(); $query->executeUpdate();
} }
/** /**
@ -2817,7 +2817,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) ->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))); ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
$result = $query->execute(); $result = $query->executeQuery();
$objectIds = $result->fetch(); $objectIds = $result->fetch();
$result->closeCursor(); $result->closeCursor();