Skip to content

Commit

Permalink
Fix usage of rename executeUpdate
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed May 5, 2021
1 parent 865661e commit 99f2fa7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
48 changes: 24 additions & 24 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ public function createCalendar($principalUri, $calendarUri, array $properties) {
foreach ($values as $column => $value) {
$query->setValue($column, $query->createNamedParameter($value));
}
$query->executeUpdate();
$query->executeStatement();
$calendarId = $query->getLastInsertId();

$calendarData = $this->getCalendarById($calendarId);
Expand Down Expand Up @@ -860,7 +860,7 @@ public function updateCalendar($calendarId, PropPatch $propPatch) {
$query->set($fieldName, $query->createNamedParameter($value));
}
$query->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
$query->executeUpdate();
$query->executeStatement();

$this->addChange($calendarId, "", 2);

Expand Down Expand Up @@ -905,7 +905,7 @@ public function deleteCalendar($calendarId) {
$query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)))
->executeUpdate();
->executeStatement();

// Only dispatch if we actually deleted anything
if ($calendarData) {
Expand Down Expand Up @@ -1130,7 +1130,7 @@ public function createCalendarObject($calendarId, $objectUri, $calendarData, $ca
'uid' => $query->createNamedParameter($extraData['uid']),
'calendartype' => $query->createNamedParameter($calendarType),
])
->executeUpdate();
->executeStatement();

$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
$this->addChange($calendarId, $objectUri, 1, $calendarType);
Expand Down Expand Up @@ -1203,7 +1203,7 @@ public function updateCalendarObject($calendarId, $objectUri, $calendarData, $ca
->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)))
->executeUpdate();
->executeStatement();

$this->updateProperties($calendarId, $objectUri, $calendarData, $calendarType);
$this->addChange($calendarId, $objectUri, 2, $calendarType);
Expand Down Expand Up @@ -1257,7 +1257,7 @@ public function setClassification($calendarObjectId, $classification) {
$query->update('calendarobjects')
->set('classification', $query->createNamedParameter($classification))
->where($query->expr()->eq('id', $query->createNamedParameter($calendarObjectId)))
->executeUpdate();
->executeStatement();
}

/**
Expand Down Expand Up @@ -2151,7 +2151,7 @@ public function createSubscription($principalUri, $uri, array $properties) {

$query->insert('calendarsubscriptions')
->values($valuesToInsert)
->executeUpdate();
->executeStatement();

$subscriptionId = $query->getLastInsertId();

Expand Down Expand Up @@ -2206,7 +2206,7 @@ public function updateSubscription($subscriptionId, PropPatch $propPatch) {
$query->set($fieldName, $query->createNamedParameter($value));
}
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
->executeUpdate();
->executeStatement();

$subscriptionRow = $this->getSubscriptionById($subscriptionId);
$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
Expand Down Expand Up @@ -2241,23 +2241,23 @@ public function deleteSubscription($subscriptionId) {
$query = $this->db->getQueryBuilder();
$query->delete('calendarsubscriptions')
->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
->executeUpdate();
->executeStatement();

$query = $this->db->getQueryBuilder();
$query->delete('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->executeUpdate();
->executeStatement();

$query->delete('calendarchanges')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->executeUpdate();
->executeStatement();

$query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->executeUpdate();
->executeStatement();

if ($subscriptionRow) {
$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
Expand Down Expand Up @@ -2347,7 +2347,7 @@ public function deleteSchedulingObject($principalUri, $objectUri) {
$query->delete('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($objectUri)))
->executeUpdate();
->executeStatement();
}

/**
Expand All @@ -2369,7 +2369,7 @@ public function createSchedulingObject($principalUri, $objectUri, $objectData) {
'etag' => $query->createNamedParameter(md5($objectData)),
'size' => $query->createNamedParameter(strlen($objectData))
])
->executeUpdate();
->executeStatement();
}

/**
Expand Down Expand Up @@ -2401,7 +2401,7 @@ protected function addChange($calendarId, $objectUri, $operation, $calendarType
'operation' => $query->createNamedParameter($operation),
'calendartype' => $query->createNamedParameter($calendarType),
])
->executeUpdate();
->executeStatement();

$stmt = $this->db->prepare("UPDATE `*PREFIX*$table` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?");
$stmt->execute([
Expand Down Expand Up @@ -2584,15 +2584,15 @@ public function setPublishStatus($value, $calendar) {
'resourceid' => $query->createNamedParameter($calendar->getResourceId()),
'publicuri' => $query->createNamedParameter($publicUri)
]);
$query->executeUpdate();
$query->executeStatement();

$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
return $publicUri;
}
$query->delete('dav_shares')
->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId())))
->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
$query->executeUpdate();
$query->executeStatement();

$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
return null;
Expand Down Expand Up @@ -2676,7 +2676,7 @@ public function updateProperties($calendarId, $objectUri, $calendarData, $calend
$query->setParameter('name', $property->name);
$query->setParameter('parameter', null);
$query->setParameter('value', $value);
$query->executeUpdate();
$query->executeStatement();
}

if (array_key_exists($property->name, self::$indexParameters)) {
Expand All @@ -2693,7 +2693,7 @@ public function updateProperties($calendarId, $objectUri, $calendarData, $calend
$query->setParameter('name', $property->name);
$query->setParameter('parameter', mb_strcut($key, 0, 254));
$query->setParameter('value', mb_strcut($value, 0, 254));
$query->executeUpdate();
$query->executeStatement();
}
}
}
Expand Down Expand Up @@ -2737,17 +2737,17 @@ public function purgeAllCachedEventsForSubscription($subscriptionId) {
$query->delete('calendarobjects')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->executeUpdate();
->executeStatement();

$query->delete('calendarchanges')
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->executeUpdate();
->executeStatement();

$query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('calendarid', $query->createNamedParameter($subscriptionId)))
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
->executeUpdate();
->executeStatement();

foreach ($uris as $uri) {
$this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
Expand All @@ -2769,7 +2769,7 @@ public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName
->set('uri', $query->createNamedParameter($newUriName ?: $uriName))
->where($query->expr()->eq('principaluri', $query->createNamedParameter($uriOrigin)))
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($uriName)))
->executeUpdate();
->executeStatement();
}

/**
Expand All @@ -2793,7 +2793,7 @@ protected function purgeProperties($calendarId, $objectId) {
$query->delete($this->dbObjectPropertiesTable)
->where($query->expr()->eq('objectid', $query->createNamedParameter($objectId)))
->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
$query->executeUpdate();
$query->executeStatement();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public function move($id) {
->set('remote_id', $qb->createNamedParameter($newRemoteId))
->where($qb->expr()->eq('remote_id', $qb->createNamedParameter($id)))
->andWhere($qb->expr()->eq('share_token', $qb->createNamedParameter($token)));
$affected = $query->executeUpdate();
$affected = $query->executeStatement();

if ($affected > 0) {
return new Http\DataResponse(['remote' => $cloudId->getRemote(), 'owner' => $cloudId->getUser()]);
Expand Down
12 changes: 6 additions & 6 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private static function copyFilesToUser($sourcePath, $owner, $targetPath, $user,
->setValue('timestamp', $query->createNamedParameter($timestamp))
->setValue('location', $query->createNamedParameter($targetLocation))
->setValue('user', $query->createNamedParameter($user));
$result = $query->executeUpdate();
$result = $query->executeStatement();
if (!$result) {
\OC::$server->getLogger()->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']);
}
Expand Down Expand Up @@ -353,7 +353,7 @@ public static function move2trash($file_path, $ownerOnly = false) {
->setValue('timestamp', $query->createNamedParameter($timestamp))
->setValue('location', $query->createNamedParameter($location))
->setValue('user', $query->createNamedParameter($owner));
$result = $query->executeUpdate();
$result = $query->executeStatement();
if (!$result) {
\OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
}
Expand Down Expand Up @@ -516,7 +516,7 @@ public static function restore($file, $filename, $timestamp) {
->where($query->expr()->eq('user', $query->createNamedParameter($user)))
->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename)))
->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp)));
$query->executeUpdate();
$query->executeStatement();
}

return true;
Expand Down Expand Up @@ -606,7 +606,7 @@ public static function deleteAll() {
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$query->delete('files_trash')
->where($query->expr()->eq('user', $query->createNamedParameter($user)));
$query->executeUpdate();
$query->executeStatement();

// Bulk PostDelete-Hook
\OC_Hook::emit('\OCP\Trashbin', 'deleteAll', ['paths' => $filePaths]);
Expand Down Expand Up @@ -660,7 +660,7 @@ public static function delete($filename, $user, $timestamp = null) {
->where($query->expr()->eq('user', $query->createNamedParameter($user)))
->andWhere($query->expr()->eq('id', $query->createNamedParameter($filename)))
->andWhere($query->expr()->eq('timestamp', $query->createNamedParameter($timestamp)));
$query->executeUpdate();
$query->executeStatement();

$file = $filename . '.d' . $timestamp;
} else {
Expand Down Expand Up @@ -746,7 +746,7 @@ public static function deleteUser($uid) {
$query = \OC::$server->getDatabaseConnection()->getQueryBuilder();
$query->delete('files_trash')
->where($query->expr()->eq('user', $query->createNamedParameter($uid)));
return (bool) $query->executeUpdate();
return (bool) $query->executeStatement();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/oauth2/lib/Db/AccessTokenMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ public function deleteByClientId(int $id) {
$qb
->delete($this->tableName)
->where($qb->expr()->eq('client_id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)));
$qb->executeUpdate();
$qb->executeStatement();
}
}
8 changes: 4 additions & 4 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $
*/
$qb->setValue('file_target', $qb->createNamedParameter(''));

$qb->executeUpdate();
$qb->executeStatement();
return $qb->getLastInsertId();
}

Expand Down Expand Up @@ -732,7 +732,7 @@ public function update(IShare $share, $plainTextPassword = null) {
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
->set('note', $qb->createNamedParameter($share->getNote()))
->set('hide_download', $qb->createNamedParameter((int)$share->getHideDownload(), IQueryBuilder::PARAM_INT))
->executeUpdate();
->executeStatement();

if ($originalShare->getNote() !== $share->getNote() && $share->getNote() !== '') {
$this->sendNote($share);
Expand Down Expand Up @@ -964,7 +964,7 @@ protected function removeShareFromTable($shareId) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId)));
$qb->executeUpdate();
$qb->executeStatement();
}

/**
Expand Down Expand Up @@ -1058,7 +1058,7 @@ public function userDeleted($uid, $shareType) {
$qb->delete('share')
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL)))
->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid)))
->executeUpdate();
->executeStatement();
}

/**
Expand Down

0 comments on commit 99f2fa7

Please sign in to comment.