diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index e95a6f47c1ff1..8ae8f596bcb16 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -298,7 +298,7 @@ protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, $query->automaticTablePrefix(false); $query->select($query->func()->count('*', 'num_entries')) ->from($table->getName()); - $result = $query->execute(); + $result = $query->executeQuery(); $count = $result->fetchOne(); $result->closeCursor(); @@ -337,7 +337,7 @@ protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, for ($chunk = 0; $chunk < $numChunks; $chunk++) { $query->setFirstResult($chunk * $chunkSize); - $result = $query->execute(); + $result = $query->executeQuery(); try { $toDB->beginTransaction(); @@ -359,7 +359,7 @@ protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, $insertQuery->setParameter($key, $value); } } - $insertQuery->execute(); + $insertQuery->executeStatement(); } $result->closeCursor(); diff --git a/core/Command/Preview/ResetRenderedTexts.php b/core/Command/Preview/ResetRenderedTexts.php index ec57f632ac9e7..b672b82ef7b69 100644 --- a/core/Command/Preview/ResetRenderedTexts.php +++ b/core/Command/Preview/ResetRenderedTexts.php @@ -137,7 +137,7 @@ private function getPreviewsToDelete(): \Iterator { $qb->select('path', 'mimetype') ->from('filecache') ->where($qb->expr()->eq('fileid', $qb->createNamedParameter($this->previewFolder->getId()))); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $data = $cursor->fetch(); $cursor->closeCursor(); @@ -170,7 +170,7 @@ private function getPreviewsToDelete(): \Iterator { ) ); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($row = $cursor->fetch()) { yield $row; diff --git a/core/Db/LoginFlowV2Mapper.php b/core/Db/LoginFlowV2Mapper.php index 8b6a342545c61..7c320dae37a49 100644 --- a/core/Db/LoginFlowV2Mapper.php +++ b/core/Db/LoginFlowV2Mapper.php @@ -88,7 +88,7 @@ public function cleanup(): void { $qb->expr()->lt('timestamp', $qb->createNamedParameter($this->timeFactory->getTime() - self::lifetime)) ); - $qb->execute(); + $qb->executeStatement(); } /** diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 9865438161b20..e2ea0b89aa264 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -273,7 +273,7 @@ public function deleteUser(IUser $user): void { $query = $this->connection->getQueryBuilder(); $query->delete($this->table) ->where($query->expr()->eq('uid', $query->createNamedParameter($uid))) - ->execute(); + ->executeStatement(); $this->deleteUserData($user); } @@ -286,7 +286,7 @@ public function deleteUserData(IUser $user): void { $query = $this->connection->getQueryBuilder(); $query->delete($this->dataTable) ->where($query->expr()->eq('uid', $query->createNamedParameter($uid))) - ->execute(); + ->executeStatement(); } /** diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 84f0d5b9e5add..62cbac2d5bcdd 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -306,7 +306,7 @@ public function setValue($app, $key, $value) { } } - $changedRow = (bool) $sql->execute(); + $changedRow = (bool) $sql->executeStatement(); $this->cache[$app][$key] = $value; @@ -329,7 +329,7 @@ public function deleteKey($app, $key) { ->andWhere($sql->expr()->eq('configkey', $sql->createParameter('configkey'))) ->setParameter('app', $app) ->setParameter('configkey', $key); - $sql->execute(); + $sql->executeStatement(); unset($this->cache[$app][$key]); return false; @@ -350,7 +350,7 @@ public function deleteApp($app) { $sql->delete('appconfig') ->where($sql->expr()->eq('appid', $sql->createParameter('app'))) ->setParameter('app', $app); - $sql->execute(); + $sql->executeStatement(); unset($this->cache[$app]); return false; @@ -415,7 +415,7 @@ protected function loadConfigValues() { $sql = $this->conn->getQueryBuilder(); $sql->select('*') ->from('appconfig'); - $result = $sql->execute(); + $result = $sql->executeQuery(); // we are going to store the result in memory anyway $rows = $result->fetchAll(); diff --git a/lib/private/Authentication/Token/PublicKeyTokenMapper.php b/lib/private/Authentication/Token/PublicKeyTokenMapper.php index 855639dd9072c..951e43680d890 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenMapper.php +++ b/lib/private/Authentication/Token/PublicKeyTokenMapper.php @@ -51,7 +51,7 @@ public function invalidate(string $token) { $qb->delete($this->tableName) ->where($qb->expr()->eq('token', $qb->createNamedParameter($token))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))) - ->execute(); + ->executeStatement(); } /** @@ -66,7 +66,7 @@ public function invalidateOld(int $olderThan, int $remember = IToken::DO_NOT_REM ->andWhere($qb->expr()->eq('type', $qb->createNamedParameter(IToken::TEMPORARY_TOKEN, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('remember', $qb->createNamedParameter($remember, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))) - ->execute(); + ->executeStatement(); } public function invalidateLastUsedBefore(string $uid, int $before): int { @@ -90,7 +90,7 @@ public function getToken(string $token): PublicKeyToken { ->from($this->tableName) ->where($qb->expr()->eq('token', $qb->createNamedParameter($token))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))) - ->execute(); + ->executeQuery(); $data = $result->fetch(); $result->closeCursor(); @@ -112,7 +112,7 @@ public function getTokenById(int $id): PublicKeyToken { ->from($this->tableName) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))) - ->execute(); + ->executeQuery(); $data = $result->fetch(); $result->closeCursor(); @@ -139,7 +139,7 @@ public function getTokenByUser(string $uid): array { ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))) ->setMaxResults(1000); - $result = $qb->execute(); + $result = $qb->executeQuery(); $data = $result->fetchAll(); $result->closeCursor(); @@ -157,7 +157,7 @@ public function deleteById(string $uid, int $id) { ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); } /** @@ -170,7 +170,7 @@ public function deleteByName(string $name) { $qb->delete($this->tableName) ->where($qb->expr()->eq('name', $qb->createNamedParameter($name), IQueryBuilder::PARAM_STR)) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); } public function deleteTempToken(PublicKeyToken $except) { @@ -182,7 +182,7 @@ public function deleteTempToken(PublicKeyToken $except) { ->andWhere($qb->expr()->neq('id', $qb->createNamedParameter($except->getId()))) ->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT))); - $qb->execute(); + $qb->executeStatement(); } public function hasExpiredTokens(string $uid): bool { @@ -193,7 +193,7 @@ public function hasExpiredTokens(string $uid): bool { ->andWhere($qb->expr()->eq('password_invalid', $qb->createNamedParameter(true), IQueryBuilder::PARAM_BOOL)) ->setMaxResults(1); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $data = $cursor->fetchAll(); $cursor->closeCursor(); diff --git a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php index 4817c6b8de076..f190a12b5fa48 100644 --- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php +++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php @@ -56,7 +56,7 @@ public function getState(string $uid): array { $query = $qb->select('provider_id', 'enabled') ->from(self::TABLE_NAME) ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); - $result = $query->execute(); + $result = $query->executeQuery(); $providers = []; foreach ($result->fetchAll() as $row) { $providers[(string)$row['provider_id']] = 1 === (int)$row['enabled']; @@ -80,14 +80,14 @@ public function persist(string $providerId, string $uid, int $enabled): void { 'enabled' => $qb->createNamedParameter($enabled, IQueryBuilder::PARAM_INT), ]); - $insertQuery->execute(); + $insertQuery->executeStatement(); } catch (UniqueConstraintViolationException $ex) { // There is already an entry -> update it $updateQuery = $qb->update(self::TABLE_NAME) ->set('enabled', $qb->createNamedParameter($enabled)) ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter($providerId))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid))); - $updateQuery->execute(); + $updateQuery->executeStatement(); } } @@ -103,7 +103,7 @@ public function deleteByUser(string $uid): array { $selectQuery = $qb1->select('*') ->from(self::TABLE_NAME) ->where($qb1->expr()->eq('uid', $qb1->createNamedParameter($uid))); - $selectResult = $selectQuery->execute(); + $selectResult = $selectQuery->executeQuery(); $rows = $selectResult->fetchAll(); $selectResult->closeCursor(); @@ -111,7 +111,7 @@ public function deleteByUser(string $uid): array { $deleteQuery = $qb2 ->delete(self::TABLE_NAME) ->where($qb2->expr()->eq('uid', $qb2->createNamedParameter($uid))); - $deleteQuery->execute(); + $deleteQuery->executeStatement(); return array_map(function (array $row) { return [ @@ -128,6 +128,6 @@ public function deleteAll(string $providerId): void { $deleteQuery = $qb->delete(self::TABLE_NAME) ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter($providerId))); - $deleteQuery->execute(); + $deleteQuery->executeStatement(); } } diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 36cccbd4eab75..e93383c4b9618 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -119,11 +119,11 @@ public function remove($job, $argument = null): void { $query->setMaxResults($max); do { - $deleted = $query->execute(); + $deleted = $query->executeStatement(); } while ($deleted === $max); } else { // Dont use chunked delete - let the DB handle the large row count natively - $query->execute(); + $query->executeStatement(); } } diff --git a/lib/private/Collaboration/Resources/Collection.php b/lib/private/Collaboration/Resources/Collection.php index e34c38a80cd3b..aa6f4b1668359 100644 --- a/lib/private/Collaboration/Resources/Collection.php +++ b/lib/private/Collaboration/Resources/Collection.php @@ -100,7 +100,7 @@ public function setName(string $name): void { $query->update(Manager::TABLE_COLLECTIONS) ->set('name', $query->createNamedParameter($name)) ->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))); - $query->execute(); + $query->executeStatement(); $this->name = $name; } @@ -142,7 +142,7 @@ public function addResource(IResource $resource): void { ]); try { - $query->execute(); + $query->executeStatement(); } catch (ConstraintViolationException $e) { throw new ResourceException('Already part of the collection'); } @@ -166,7 +166,7 @@ public function removeResource(IResource $resource): void { ->where($query->expr()->eq('collection_id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT))) ->andWhere($query->expr()->eq('resource_type', $query->createNamedParameter($resource->getType()))) ->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resource->getId()))); - $query->execute(); + $query->executeStatement(); if (empty($this->resources)) { $this->removeCollection(); @@ -222,7 +222,7 @@ protected function removeCollection(): void { $query = $this->connection->getQueryBuilder(); $query->delete(Manager::TABLE_COLLECTIONS) ->where($query->expr()->eq('id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT))); - $query->execute(); + $query->executeStatement(); $this->manager->invalidateAccessCacheForCollection($this); $this->id = 0; diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php index fc8804e69b4dc..0746e8a7a71dc 100644 --- a/lib/private/Collaboration/Resources/Manager.php +++ b/lib/private/Collaboration/Resources/Manager.php @@ -73,7 +73,7 @@ public function getCollection(int $id): ICollection { $query->select('*') ->from(self::TABLE_COLLECTIONS) ->where($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -105,7 +105,7 @@ public function getCollectionForUser(int $id, ?IUser $user): ICollection { ) ) ->where($query->expr()->eq('c.id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -151,7 +151,7 @@ public function searchCollections(IUser $user, string $filter, int $limit = 50, $query->andWhere($query->expr()->iLike('c.name', $query->createNamedParameter('%' . $this->connection->escapeLikeParameter($filter) . '%'))); } - $result = $query->execute(); + $result = $query->executeQuery(); $collections = []; $foundResults = 0; @@ -183,7 +183,7 @@ public function newCollection(string $name): ICollection { ->values([ 'name' => $query->createNamedParameter($name), ]); - $query->execute(); + $query->executeStatement(); return new Collection($this, $this->connection, $query->getLastInsertId(), $name); } @@ -222,7 +222,7 @@ public function getResourceForUser(string $type, string $id, ?IUser $user): IRes ) ->where($query->expr()->eq('r.resource_type', $query->createNamedParameter($type, IQueryBuilder::PARAM_STR))) ->andWhere($query->expr()->eq('r.resource_id', $query->createNamedParameter($id, IQueryBuilder::PARAM_STR))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -261,7 +261,7 @@ public function getResourcesByCollectionForUser(ICollection $collection, ?IUser ->where($query->expr()->eq('r.collection_id', $query->createNamedParameter($collection->getId(), IQueryBuilder::PARAM_INT))); $resources = []; - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $access = $row['access'] === null ? null : (bool) $row['access']; $resources[] = new Resource($this, $this->connection, $row['resource_type'], $row['resource_id'], $user, $access); @@ -363,7 +363,7 @@ protected function checkAccessCacheForUserByResource(IResource $resource, ?IUser ->setMaxResults(1); $hasAccess = null; - $result = $query->execute(); + $result = $query->executeQuery(); if ($row = $result->fetch()) { $hasAccess = (bool) $row['access']; } @@ -383,7 +383,7 @@ protected function checkAccessCacheForUserByCollection(ICollection $collection, ->setMaxResults(1); $hasAccess = null; - $result = $query->execute(); + $result = $query->executeQuery(); if ($row = $result->fetch()) { $hasAccess = (bool) $row['access']; } @@ -404,7 +404,7 @@ public function cacheAccessForResource(IResource $resource, ?IUser $user, bool $ 'access' => $query->createNamedParameter($access, IQueryBuilder::PARAM_BOOL), ]); try { - $query->execute(); + $query->executeStatement(); } catch (UniqueConstraintViolationException $e) { } } @@ -420,7 +420,7 @@ public function cacheAccessForCollection(ICollection $collection, ?IUser $user, 'access' => $query->createNamedParameter($access, IQueryBuilder::PARAM_BOOL), ]); try { - $query->execute(); + $query->executeStatement(); } catch (UniqueConstraintViolationException $e) { } } @@ -431,7 +431,7 @@ public function invalidateAccessCacheForUser(?IUser $user): void { $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('user_id', $query->createNamedParameter($userId))); - $query->execute(); + $query->executeStatement(); } public function invalidateAccessCacheForResource(IResource $resource): void { @@ -440,7 +440,7 @@ public function invalidateAccessCacheForResource(IResource $resource): void { $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('resource_id', $query->createNamedParameter($resource->getId()))) ->andWhere($query->expr()->eq('resource_type', $query->createNamedParameter($resource->getType(), IQueryBuilder::PARAM_STR))); - $query->execute(); + $query->executeStatement(); foreach ($resource->getCollections() as $collection) { $this->invalidateAccessCacheForCollection($collection); @@ -452,7 +452,7 @@ public function invalidateAccessCacheForAllCollections(): void { $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->neq('collection_id', $query->createNamedParameter(0))); - $query->execute(); + $query->executeStatement(); } public function invalidateAccessCacheForCollection(ICollection $collection): void { @@ -460,7 +460,7 @@ public function invalidateAccessCacheForCollection(ICollection $collection): voi $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('collection_id', $query->createNamedParameter($collection->getId()))); - $query->execute(); + $query->executeStatement(); } public function invalidateAccessCacheForProvider(IProvider $provider): void { @@ -468,7 +468,7 @@ public function invalidateAccessCacheForProvider(IProvider $provider): void { $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('resource_type', $query->createNamedParameter($provider->getType(), IQueryBuilder::PARAM_STR))); - $query->execute(); + $query->executeStatement(); } public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUser $user): void { @@ -478,7 +478,7 @@ public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUs $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('resource_id', $query->createNamedParameter($resource->getId()))) ->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($userId))); - $query->execute(); + $query->executeStatement(); foreach ($resource->getCollections() as $collection) { $this->invalidateAccessCacheForCollectionByUser($collection, $user); @@ -492,7 +492,7 @@ protected function invalidateAccessCacheForCollectionByUser(ICollection $collect $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('collection_id', $query->createNamedParameter($collection->getId()))) ->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($userId))); - $query->execute(); + $query->executeStatement(); } public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUser $user): void { @@ -502,7 +502,7 @@ public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUs $query->delete(self::TABLE_ACCESS_CACHE) ->where($query->expr()->eq('resource_type', $query->createNamedParameter($provider->getType(), IQueryBuilder::PARAM_STR))) ->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($userId))); - $query->execute(); + $query->executeStatement(); } /** diff --git a/lib/private/Collaboration/Resources/Resource.php b/lib/private/Collaboration/Resources/Resource.php index b5e0215cb39cd..82bb2c3dd1c34 100644 --- a/lib/private/Collaboration/Resources/Resource.php +++ b/lib/private/Collaboration/Resources/Resource.php @@ -150,7 +150,7 @@ public function getCollections(): array { ->where($query->expr()->eq('resource_type', $query->createNamedParameter($this->getType()))) ->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($this->getId()))); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $collections[] = $this->manager->getCollection((int) $row['collection_id']); } diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index af4fda277d6cf..ccf15131414a4 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -200,7 +200,7 @@ protected function updateChildrenInformation($id, \DateTime $cDateTime): void { ->where($qb->expr()->eq('parent_id', $qb->createParameter('id'))) ->setParameter('id', $id); - $resultStatement = $query->execute(); + $resultStatement = $query->executeQuery(); $data = $resultStatement->fetch(\PDO::FETCH_NUM); $resultStatement->closeCursor(); $children = (int)$data[0]; @@ -274,7 +274,7 @@ public function get($id): IComment { ->from('comments') ->where($qb->expr()->eq('id', $qb->createParameter('id'))) ->setParameter('id', $id, IQueryBuilder::PARAM_INT) - ->execute(); + ->executeQuery(); $data = $resultStatement->fetch(); $resultStatement->closeCursor(); @@ -310,7 +310,7 @@ public function getTree($id, $limit = 0, $offset = 0): array { $query->setFirstResult($offset); } - $resultStatement = $query->execute(); + $resultStatement = $query->executeQuery(); while ($data = $resultStatement->fetch()) { $comment = $this->getCommentFromData($data); $this->cache($comment); @@ -369,7 +369,7 @@ public function getForObject( ->setParameter('notOlderThan', $notOlderThan, 'datetime'); } - $resultStatement = $query->execute(); + $resultStatement = $query->executeQuery(); while ($data = $resultStatement->fetch()) { $comment = $this->getCommentFromData($data); $this->cache($comment); @@ -503,7 +503,7 @@ public function getCommentsWithVerbForObjectSinceComment( } } - $resultStatement = $query->execute(); + $resultStatement = $query->executeQuery(); while ($data = $resultStatement->fetch()) { $comment = $this->getCommentFromData($data); $this->cache($comment); @@ -529,7 +529,7 @@ protected function getLastKnownComment(string $objectType, ->andWhere($query->expr()->eq('object_id', $query->createNamedParameter($objectId))) ->andWhere($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -601,7 +601,7 @@ public function searchForObjects(string $search, string $objectType, array $obje } $comments = []; - $result = $query->execute(); + $result = $query->executeQuery(); while ($data = $result->fetch()) { $comment = $this->getCommentFromData($data); $this->cache($comment); @@ -640,7 +640,7 @@ public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $ $query->andWhere($qb->expr()->eq('verb', $qb->createNamedParameter($verb))); } - $resultStatement = $query->execute(); + $resultStatement = $query->executeQuery(); $data = $resultStatement->fetch(\PDO::FETCH_NUM); $resultStatement->closeCursor(); return (int)$data[0]; @@ -755,7 +755,7 @@ public function getLastCommentBeforeDate(string $objectType, string $objectId, \ $query->andWhere($query->expr()->eq('verb', $query->createNamedParameter($verb))); } - $result = $query->execute(); + $result = $query->executeQuery(); $data = $result->fetch(); $result->closeCursor(); @@ -792,7 +792,7 @@ public function getLastCommentDateByActor( ->andWhere($query->expr()->in('actor_id', $query->createNamedParameter($actors, IQueryBuilder::PARAM_STR_ARRAY))) ->groupBy('actor_id'); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $lastComments[$row['actor_id']] = $this->timeFactory->getDateTime($row['last_comment']); } @@ -844,7 +844,7 @@ public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) { ) )->groupBy('f.fileid'); - $resultStatement = $query->execute(); + $resultStatement = $query->executeQuery(); $results = []; while ($row = $resultStatement->fetch()) { @@ -903,7 +903,7 @@ public function delete($id) { ->setParameter('id', $id); try { - $affectedRows = $query->execute(); + $affectedRows = $query->executeStatement(); $this->uncache($id); } catch (DriverException $e) { $this->logger->error($e->getMessage(), [ @@ -1173,7 +1173,7 @@ protected function insertQuery(IComment $comment, bool $tryWritingReferenceId): $affectedRows = $qb->insert('comments') ->values($values) - ->execute(); + ->executeStatement(); if ($affectedRows > 0) { $comment->setId((string)$qb->getLastInsertId()); @@ -1311,7 +1311,7 @@ protected function updateQuery(IComment $comment, bool $tryWritingReferenceId): } $affectedRows = $qb->where($qb->expr()->eq('id', $qb->createNamedParameter($comment->getId()))) - ->execute(); + ->executeStatement(); if ($affectedRows === 0) { throw new NotFoundException('Comment to update does ceased to exist'); @@ -1341,7 +1341,7 @@ public function deleteReferencesOfActor($actorType, $actorId) { ->andWhere($qb->expr()->eq('actor_id', $qb->createParameter('id'))) ->setParameter('type', $actorType) ->setParameter('id', $actorId) - ->execute(); + ->executeStatement(); $this->commentsCache = []; @@ -1366,7 +1366,7 @@ public function deleteCommentsAtObject($objectType, $objectId) { ->andWhere($qb->expr()->eq('object_id', $qb->createParameter('id'))) ->setParameter('type', $objectType) ->setParameter('id', $objectId) - ->execute(); + ->executeStatement(); $this->commentsCache = []; @@ -1387,7 +1387,7 @@ public function deleteReadMarksFromUser(IUser $user) { ->setParameter('user_id', $user->getUID()); try { - $affectedRows = $query->execute(); + $affectedRows = $query->executeStatement(); } catch (DriverException $e) { $this->logger->error($e->getMessage(), [ 'exception' => $e, @@ -1432,7 +1432,7 @@ public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $ ->setParameter('user_id', $user->getUID(), IQueryBuilder::PARAM_STR) ->setParameter('object_type', $objectType, IQueryBuilder::PARAM_STR) ->setParameter('object_id', $objectId, IQueryBuilder::PARAM_STR) - ->execute(); + ->executeStatement(); if ($affectedRows > 0) { return; @@ -1440,7 +1440,7 @@ public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $ $qb->insert('comments_read_markers') ->values($values) - ->execute(); + ->executeStatement(); } /** @@ -1464,7 +1464,7 @@ public function getReadMark($objectType, $objectId, IUser $user) { ->setParameter('user_id', $user->getUID(), IQueryBuilder::PARAM_STR) ->setParameter('object_type', $objectType, IQueryBuilder::PARAM_STR) ->setParameter('object_id', $objectId, IQueryBuilder::PARAM_STR) - ->execute(); + ->executeQuery(); $data = $resultStatement->fetch(); $resultStatement->closeCursor(); @@ -1494,7 +1494,7 @@ public function deleteReadMarksOnObject($objectType, $objectId) { ->setParameter('object_id', $objectId); try { - $affectedRows = $query->execute(); + $affectedRows = $query->executeStatement(); } catch (DriverException $e) { $this->logger->error($e->getMessage(), [ 'exception' => $e, diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 2bd1d4c824ac8..ba02880baa354 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -270,7 +270,7 @@ public function executeUpdate(string $sql, array $params = [], array $types = [] $sql = $this->adapter->fixupStatement($sql); $this->queriesExecuted++; $this->logQueryToFile($sql); - return parent::executeUpdate($sql, $params, $types); + return parent::executeStatement($sql, $params, $types); } /** diff --git a/lib/private/DB/PreparedStatement.php b/lib/private/DB/PreparedStatement.php index 849aa37983284..cf7b7abdb3fee 100644 --- a/lib/private/DB/PreparedStatement.php +++ b/lib/private/DB/PreparedStatement.php @@ -83,7 +83,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le } public function execute($params = null): IResult { - return ($this->result = new ResultAdapter($this->statement->execute($params))); + return ($this->result = new ResultAdapter($this->statement->executeQuery($params))); } public function rowCount(): int { diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 2f97b4a146c27..3993982808d19 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -277,7 +277,12 @@ public function execute() { ]); } - $result = $this->queryBuilder->execute(); + if ($this->queryBuilder->getType() === $this->queryBuilder::SELECT) { + $result = $this->queryBuilder->executeQuery(); + } else { + $result = $this->queryBuilder->executeStatement(); + } + if (is_int($result)) { return $result; } diff --git a/lib/private/DB/SQLiteSessionInit.php b/lib/private/DB/SQLiteSessionInit.php index 89f7e03c5f2da..42fc75f91b00e 100644 --- a/lib/private/DB/SQLiteSessionInit.php +++ b/lib/private/DB/SQLiteSessionInit.php @@ -57,8 +57,8 @@ public function __construct($caseSensitiveLike, $journalMode) { */ public function postConnect(ConnectionEventArgs $args) { $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; - $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); - $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); + $args->getConnection()->executeStatement('PRAGMA case_sensitive_like = ' . $sensitive); + $args->getConnection()->executeStatement('PRAGMA journal_mode = ' . $this->journalMode); /** @var \Doctrine\DBAL\Driver\PDO\Connection $connection */ $connection = $args->getConnection()->getWrappedConnection(); $pdo = $connection->getWrappedConnection(); diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php index 2dd2abe54085b..ff83a2b566cb4 100644 --- a/lib/private/DirectEditing/Manager.php +++ b/lib/private/DirectEditing/Manager.php @@ -229,7 +229,7 @@ public function getToken(string $token): IToken { $query = $this->connection->getQueryBuilder(); $query->select('*')->from(self::TABLE_TOKENS) ->where($query->expr()->eq('token', $query->createNamedParameter($token, IQueryBuilder::PARAM_STR))); - $result = $query->execute(); + $result = $query->executeQuery(); if ($tokenRow = $result->fetch(FetchMode::ASSOCIATIVE)) { return new Token($this, $tokenRow); } @@ -240,7 +240,7 @@ public function cleanup(): int { $query = $this->connection->getQueryBuilder(); $query->delete(self::TABLE_TOKENS) ->where($query->expr()->lt('timestamp', $query->createNamedParameter(time() - self::TOKEN_CLEANUP_TIME))); - return $query->execute(); + return $query->executeStatement(); } public function refreshToken(string $token): bool { @@ -248,7 +248,7 @@ public function refreshToken(string $token): bool { $query->update(self::TABLE_TOKENS) ->set('timestamp', $query->createNamedParameter(time(), IQueryBuilder::PARAM_INT)) ->where($query->expr()->eq('token', $query->createNamedParameter($token, IQueryBuilder::PARAM_STR))); - $result = $query->execute(); + $result = $query->executeStatement(); return $result !== 0; } @@ -257,7 +257,7 @@ public function invalidateToken(string $token): bool { $query = $this->connection->getQueryBuilder(); $query->delete(self::TABLE_TOKENS) ->where($query->expr()->eq('token', $query->createNamedParameter($token, IQueryBuilder::PARAM_STR))); - $result = $query->execute(); + $result = $query->executeStatement(); return $result !== 0; } @@ -267,7 +267,7 @@ public function accessToken(string $token): bool { ->set('accessed', $query->createNamedParameter(true, IQueryBuilder::PARAM_BOOL)) ->set('timestamp', $query->createNamedParameter(time(), IQueryBuilder::PARAM_INT)) ->where($query->expr()->eq('token', $query->createNamedParameter($token, IQueryBuilder::PARAM_STR))); - $result = $query->execute(); + $result = $query->executeStatement(); return $result !== 0; } @@ -294,7 +294,7 @@ public function createToken($editorId, File $file, string $filePath, IShare $sha 'share_id' => $query->createNamedParameter($share !== null ? $share->getId(): null), 'timestamp' => $query->createNamedParameter(time()) ]); - $query->execute(); + $query->executeStatement(); return $token; } diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 67d01bb699907..a6651f17edd22 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -312,7 +312,7 @@ public function insert($file, array $data) { $builder->setValue($column, $builder->createNamedParameter($value)); } - if ($builder->execute()) { + if ($builder->executeStatement()) { $fileId = $builder->getLastInsertId(); if (count($extensionValues)) { @@ -709,7 +709,7 @@ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { } try { - $query->execute(); + $query->executeStatement(); } catch (\OC\DatabaseException $e) { $this->connection->rollBack(); throw $e; @@ -761,7 +761,7 @@ public function clear() { $query = $this->connection->getQueryBuilder(); $query->delete('storages') ->where($query->expr()->eq('id', $query->createNamedParameter($this->storageId))); - $query->execute(); + $query->executeStatement(); } /** @@ -1075,7 +1075,7 @@ public static function getById($id) { ->from('filecache') ->where($query->expr()->eq('fileid', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index 327d0d80bf26d..6820a6d794eb8 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -217,13 +217,13 @@ public function commitBatch() { $query->setParameter('time', $item['time'], IQueryBuilder::PARAM_INT); $query->setParameter('hash', $item['hash']); - $query->execute(); + $query->executeStatement(); if ($item['size']) { $sizeQuery->setParameter('size', $item['size'], IQueryBuilder::PARAM_INT); $sizeQuery->setParameter('hash', $item['hash']); - $sizeQuery->execute(); + $sizeQuery->executeStatement(); } } diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 01fc638cef85e..bf64c840a204f 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -179,7 +179,7 @@ public function setAvailability($isAvailable, int $delay = 0) { ->set('available', $query->createNamedParameter($available)) ->set('last_checked', $query->createNamedParameter(time() + $delay)) ->where($query->expr()->eq('id', $query->createNamedParameter($this->storageId))); - $query->execute(); + $query->executeStatement(); } /** @@ -204,13 +204,13 @@ public static function remove($storageId) { $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $query->delete('storages') ->where($query->expr()->eq('id', $query->createNamedParameter($storageId))); - $query->execute(); + $query->executeStatement(); if (!is_null($numericId)) { $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $query->delete('filecache') ->where($query->expr()->eq('storage', $query->createNamedParameter($numericId))); - $query->execute(); + $query->executeStatement(); } } diff --git a/lib/private/Files/Cache/StorageGlobal.php b/lib/private/Files/Cache/StorageGlobal.php index 74cbd5abdb222..0c6a423a32152 100644 --- a/lib/private/Files/Cache/StorageGlobal.php +++ b/lib/private/Files/Cache/StorageGlobal.php @@ -59,7 +59,7 @@ public function loadForStorageIds(array $storageIds) { ->from('storages') ->where($builder->expr()->in('id', $builder->createNamedParameter(array_values($storageIds), IQueryBuilder::PARAM_STR_ARRAY))); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $this->cache[$row['id']] = $row; } @@ -77,7 +77,7 @@ public function getStorageInfo(string $storageId): ?array { ->from('storages') ->where($builder->expr()->eq('id', $builder->createNamedParameter($storageId))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -100,7 +100,7 @@ public function getStorageInfoByNumericId(int $numericId): ?array { ->from('storages') ->where($builder->expr()->eq('numeric_id', $builder->createNamedParameter($numericId))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index 90f94b6598e3a..805cd69b8704b 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -209,7 +209,7 @@ private function updateCachedMount(ICachedMountInfo $mount) { ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($mount->getUser()->getUID()))) ->andWhere($builder->expr()->eq('root_id', $builder->createNamedParameter($mount->getRootId(), IQueryBuilder::PARAM_INT))); - $query->execute(); + $query->executeStatement(); } private function removeFromCache(ICachedMountInfo $mount) { @@ -219,7 +219,7 @@ private function removeFromCache(ICachedMountInfo $mount) { ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($mount->getUser()->getUID()))) ->andWhere($builder->expr()->eq('root_id', $builder->createNamedParameter($mount->getRootId(), IQueryBuilder::PARAM_INT))) ->andWhere($builder->expr()->eq('mount_point', $builder->createNamedParameter($mount->getMountPoint()))); - $query->execute(); + $query->executeStatement(); } private function dbRowToMountInfo(array $row) { @@ -254,7 +254,7 @@ public function getMountsForUser(IUser $user) { ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid')) ->where($builder->expr()->eq('user_id', $builder->createPositionalParameter($user->getUID()))); - $result = $query->execute(); + $result = $query->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); @@ -279,7 +279,7 @@ public function getMountsForStorageId($numericStorageId, $user = null) { $query->andWhere($builder->expr()->eq('user_id', $builder->createPositionalParameter($user))); } - $result = $query->execute(); + $result = $query->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); @@ -297,7 +297,7 @@ public function getMountsForRootId($rootFileId) { ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid')) ->where($builder->expr()->eq('root_id', $builder->createPositionalParameter($rootFileId, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); @@ -316,7 +316,7 @@ private function getCacheInfoFromFileId($fileId): array { ->from('filecache') ->where($builder->expr()->eq('fileid', $builder->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -355,7 +355,7 @@ public function getMountsForFileId($fileId, $user = null) { $query->andWhere($builder->expr()->eq('user_id', $builder->createPositionalParameter($user))); } - $result = $query->execute(); + $result = $query->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); // filter mounts that are from the same storage but a different directory @@ -393,7 +393,7 @@ public function removeUserMounts(IUser $user) { $query = $builder->delete('mounts') ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($user->getUID()))); - $query->execute(); + $query->executeStatement(); } public function removeUserStorageMount($storageId, $userId) { @@ -402,7 +402,7 @@ public function removeUserStorageMount($storageId, $userId) { $query = $builder->delete('mounts') ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($userId))) ->andWhere($builder->expr()->eq('storage_id', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))); - $query->execute(); + $query->executeStatement(); } public function remoteStorageMounts($storageId) { @@ -410,7 +410,7 @@ public function remoteStorageMounts($storageId) { $query = $builder->delete('mounts') ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))); - $query->execute(); + $query->executeStatement(); } /** @@ -441,7 +441,7 @@ public function getUsedSpaceForUsers(array $users) { ->where($builder->expr()->eq('m.mount_point', $mountPoint)) ->andWhere($builder->expr()->in('m.user_id', $builder->createNamedParameter($userIds, IQueryBuilder::PARAM_STR_ARRAY))); - $result = $query->execute(); + $result = $query->executeQuery(); $results = []; while ($row = $result->fetch()) { diff --git a/lib/private/Files/Type/Loader.php b/lib/private/Files/Type/Loader.php index 7032e6193850f..99229d8b03cad 100644 --- a/lib/private/Files/Type/Loader.php +++ b/lib/private/Files/Type/Loader.php @@ -158,7 +158,7 @@ private function loadMimetypes() { $qb->select('id', 'mimetype') ->from('mimetypes'); - $result = $qb->execute(); + $result = $qb->executeQuery(); $results = $result->fetchAll(); $result->closeCursor(); @@ -190,6 +190,6 @@ public function updateFilecache($ext, $mimeTypeId) { $update->func()->lower('name'), $update->createNamedParameter('%' . $this->dbConnection->escapeLikeParameter('.' . $ext)) )); - return $update->execute(); + return $update->executeStatement(); } } diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 55792ce1dff19..578618356e7cf 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -103,7 +103,7 @@ public function createGroup(string $gid): bool { $result = $builder->insert('groups') ->setValue('gid', $builder->createNamedParameter($gid)) ->setValue('displayname', $builder->createNamedParameter($gid)) - ->execute(); + ->executeStatement(); } catch (UniqueConstraintViolationException $e) { $result = 0; } @@ -131,19 +131,19 @@ public function deleteGroup(string $gid): bool { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('groups') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) - ->execute(); + ->executeStatement(); // Delete the group-user relation $qb = $this->dbConn->getQueryBuilder(); $qb->delete('group_user') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) - ->execute(); + ->executeStatement(); // Delete the group-groupadmin relation $qb = $this->dbConn->getQueryBuilder(); $qb->delete('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) - ->execute(); + ->executeStatement(); // Delete from cache unset($this->groupCache[$gid]); @@ -168,7 +168,7 @@ public function inGroup($uid, $gid) { ->from('group_user') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) - ->execute(); + ->executeQuery(); $result = $cursor->fetch(); $cursor->closeCursor(); @@ -193,7 +193,7 @@ public function addToGroup(string $uid, string $gid): bool { $qb->insert('group_user') ->setValue('uid', $qb->createNamedParameter($uid)) ->setValue('gid', $qb->createNamedParameter($gid)) - ->execute(); + ->executeStatement(); return true; } else { return false; @@ -215,7 +215,7 @@ public function removeFromGroup(string $uid, string $gid): bool { $qb->delete('group_user') ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) ->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) - ->execute(); + ->executeStatement(); return true; } @@ -242,7 +242,7 @@ public function getUserGroups($uid) { ->from('group_user', 'gu') ->leftJoin('gu', 'groups', 'g', $qb->expr()->eq('gu.gid', 'g.gid')) ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) - ->execute(); + ->executeQuery(); $groups = []; while ($row = $cursor->fetch()) { @@ -289,7 +289,7 @@ public function getGroups(string $search = '', int $limit = -1, int $offset = 0) if ($offset > 0) { $query->setFirstResult($offset); } - $result = $query->execute(); + $result = $query->executeQuery(); $groups = []; while ($row = $result->fetch()) { @@ -321,7 +321,7 @@ public function groupExists($gid) { $cursor = $qb->select('gid', 'displayname') ->from('groups') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) - ->execute(); + ->executeQuery(); $result = $cursor->fetch(); $cursor->closeCursor(); @@ -452,7 +452,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int { ))); } - $result = $query->execute(); + $result = $query->executeQuery(); $count = $result->fetchOne(); $result->closeCursor(); @@ -484,7 +484,7 @@ public function countDisabledInGroup(string $gid): int { ->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('false'), IQueryBuilder::PARAM_STR)) ->andWhere($query->expr()->eq('gid', $query->createNamedParameter($gid), IQueryBuilder::PARAM_STR)); - $result = $query->execute(); + $result = $query->executeQuery(); $count = $result->fetchOne(); $result->closeCursor(); @@ -513,7 +513,7 @@ public function getDisplayName(string $gid): string { ->from('groups') ->where($query->expr()->eq('gid', $query->createNamedParameter($gid))); - $result = $query->execute(); + $result = $query->executeQuery(); $displayName = $result->fetchOne(); $result->closeCursor(); @@ -582,7 +582,7 @@ public function setDisplayName(string $gid, string $displayName): bool { $query->update('groups') ->set('displayname', $query->createNamedParameter($displayName)) ->where($query->expr()->eq('gid', $query->createNamedParameter($gid))); - $query->execute(); + $query->executeStatement(); return true; } diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index 4eba96d1a827d..e04148c1356c4 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -99,7 +99,7 @@ private function getOldPreviewLocations(): \Iterator { $qb->setMaxResults(10); } - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($row = $cursor->fetch()) { yield $row['name']; @@ -113,7 +113,7 @@ private function getNewPreviewLocations(): \Iterator { $qb->select('path', 'mimetype') ->from('filecache') ->where($qb->expr()->eq('fileid', $qb->createNamedParameter($this->previewFolder->getId()))); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $data = $cursor->fetch(); $cursor->closeCursor(); @@ -162,7 +162,7 @@ private function getNewPreviewLocations(): \Iterator { $qb->setMaxResults(10); } - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($row = $cursor->fetch()) { yield $row['name']; diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php index 531fcc1112f9e..adfef8f089444 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -92,7 +92,7 @@ protected function checkTags($offset) { ->orderBy('uid') ->setMaxResults(50) ->setFirstResult($offset); - $result = $query->execute(); + $result = $query->executeQuery(); $users = []; $hadResults = false; @@ -113,7 +113,7 @@ protected function checkTags($offset) { $query = $this->connection->getQueryBuilder(); $query->delete('vcategory') ->where($query->expr()->in('uid', $query->createNamedParameter($users, IQueryBuilder::PARAM_STR_ARRAY))); - $this->deletedTags += $query->execute(); + $this->deletedTags += $query->executeStatement(); } return true; } @@ -181,7 +181,7 @@ protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTabl ->andWhere( $qb->expr()->isNull('s.' . $sourceNullColumn) ); - $result = $qb->execute(); + $result = $qb->executeQuery(); $orphanItems = []; while ($row = $result->fetch()) { @@ -197,7 +197,7 @@ protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTabl ) ->andWhere($qb->expr()->in($deleteId, $qb->createParameter('ids'))); $qb->setParameter('ids', $items, IQueryBuilder::PARAM_INT_ARRAY); - $qb->execute(); + $qb->executeStatement(); } } diff --git a/lib/private/Repair/NC11/FixMountStorages.php b/lib/private/Repair/NC11/FixMountStorages.php index 4cf721e9b1344..00d14d5a778c1 100644 --- a/lib/private/Repair/NC11/FixMountStorages.php +++ b/lib/private/Repair/NC11/FixMountStorages.php @@ -58,12 +58,12 @@ public function run(IOutput $output) { ->set('storage_id', $update->createParameter('storage')) ->where($query->expr()->eq('id', $update->createParameter('mount'))); - $result = $query->execute(); + $result = $query->executeQuery(); $entriesUpdated = 0; while ($row = $result->fetch()) { $update->setParameter('storage', $row['storage'], IQueryBuilder::PARAM_INT) ->setParameter('mount', $row['id'], IQueryBuilder::PARAM_INT); - $update->execute(); + $update->executeStatement(); $entriesUpdated++; } $result->closeCursor(); diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php index be507debbd996..3c27ef91128c4 100644 --- a/lib/private/Repair/OldGroupMembershipShares.php +++ b/lib/private/Repair/OldGroupMembershipShares.php @@ -81,11 +81,11 @@ public function run(IOutput $output) { $deleteQuery->delete('share') ->where($query->expr()->eq('id', $deleteQuery->createParameter('share'))); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { if (!$this->isMember($row['group'], $row['user'])) { $deletedEntries += $deleteQuery->setParameter('share', (int) $row['id']) - ->execute(); + ->executeStatement(); } } $result->closeCursor(); diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 94fd15542936e..77fccba36da6c 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -139,7 +139,7 @@ protected function runStep($offset) { $query->setFirstResult($offset); } - $result = $query->execute(); + $result = $query->executeQuery(); $update = $this->db->getQueryBuilder(); $update->update('users') @@ -193,7 +193,7 @@ protected function migrateUserInfo(IQueryBuilder $update, $userdata) { if ($userdata['display_name'] !== null) { $update->setParameter('displayname', $userdata['display_name']) ->setParameter('userid', $userdata['user_id']); - $update->execute(); + $update->executeStatement(); } } } diff --git a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php index e08a0b55a9a84..a10128015d049 100644 --- a/lib/private/Repair/Owncloud/UpdateLanguageCodes.php +++ b/lib/private/Repair/Owncloud/UpdateLanguageCodes.php @@ -80,7 +80,7 @@ public function run(IOutput $output) { ->where($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) ->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($oldCode), IQueryBuilder::PARAM_STR)) - ->execute(); + ->executeStatement(); $output->info('Changed ' . $affectedRows . ' setting(s) from "' . $oldCode . '" to "' . $newCode . '" in preferences table.'); } diff --git a/lib/private/Repair/RemoveLinkShares.php b/lib/private/Repair/RemoveLinkShares.php index b45a1d83a56c0..20df401c6a80f 100644 --- a/lib/private/Repair/RemoveLinkShares.php +++ b/lib/private/Repair/RemoveLinkShares.php @@ -95,7 +95,7 @@ private function deleteShare(int $id): void { $qb = $this->connection->getQueryBuilder(); $qb->delete('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); - $qb->execute(); + $qb->executeStatement(); } /** @@ -128,7 +128,7 @@ private function getTotal(): int { ->from('share') ->where($query->expr()->in('id', $query->createFunction($subQuery->getSQL()))); - $result = $query->execute(); + $result = $query->executeQuery(); $data = $result->fetch(); $result->closeCursor(); @@ -158,7 +158,7 @@ private function getShares(): IResult { )) ->andWhere($query->expr()->eq('s1.item_source', 's2.item_source')); /** @var IResult $result */ - $result = $query->execute(); + $result = $query->executeQuery(); return $result; } diff --git a/lib/private/Repair/RepairDavShares.php b/lib/private/Repair/RepairDavShares.php index 467adc2b0d9bb..b7e597bd07c18 100644 --- a/lib/private/Repair/RepairDavShares.php +++ b/lib/private/Repair/RepairDavShares.php @@ -81,7 +81,7 @@ protected function repairUnencodedGroupShares() { ->set('principaluri', $updateQuery->createParameter('updatedPrincipalUri')) ->where($updateQuery->expr()->eq('id', $updateQuery->createParameter('shareId'))); - $statement = $qb->execute(); + $statement = $qb->executeQuery(); while ($share = $statement->fetch()) { $gid = substr($share['principaluri'], strlen(self::GROUP_PRINCIPAL_PREFIX)); $decodedGid = urldecode($gid); @@ -110,7 +110,7 @@ protected function repairUnencodedGroupShares() { $updateQuery ->setParameter('updatedPrincipalUri', $fixedPrincipal) ->setParameter('shareId', $share['id']) - ->execute(); + ->executeStatement(); $this->logger->info('Repaired principal for dav share {id} from {old} to {new}', $logParameters); } catch (Exception $e) { $logParameters['message'] = $e->getMessage(); diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php index 9255034f6fe11..cfecff31d6cc6 100644 --- a/lib/private/Repair/RepairInvalidShares.php +++ b/lib/private/Repair/RepairInvalidShares.php @@ -67,7 +67,7 @@ private function adjustFileSharePermissions(IOutput $out) { ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file'))) ->andWhere($builder->expr()->neq('permissions', $permsFunc)); - $updatedEntries = $builder->execute(); + $updatedEntries = $builder->executeStatement(); if ($updatedEntries > 0) { $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares'); } @@ -95,11 +95,11 @@ private function removeSharesNonExistingParent(IOutput $out) { $deletedInLastChunk = self::CHUNK_SIZE; while ($deletedInLastChunk === self::CHUNK_SIZE) { $deletedInLastChunk = 0; - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $deletedInLastChunk++; $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent']) - ->execute(); + ->executeStatement(); } $result->closeCursor(); } diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php index ee5a84ad65c13..21956735ff5da 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -69,7 +69,7 @@ private function updateMimetypes($updatedMimetypes) { if (empty($this->folderMimeTypeId)) { $query->setParameter('mimetype', 'httpd/unix-directory'); - $result = $query->execute(); + $result = $query->executeQuery(); $this->folderMimeTypeId = (int)$result->fetchOne(); $result->closeCursor(); } @@ -86,21 +86,21 @@ private function updateMimetypes($updatedMimetypes) { foreach ($updatedMimetypes as $extension => $mimetype) { // get target mimetype id $query->setParameter('mimetype', $mimetype); - $result = $query->execute(); + $result = $query->executeQuery(); $mimetypeId = (int)$result->fetchOne(); $result->closeCursor(); if (!$mimetypeId) { // insert mimetype $insert->setParameter('mimetype', $mimetype); - $insert->execute(); + $insert->executeStatement(); $mimetypeId = $insert->getLastInsertId(); } // change mimetype for files with x extension $update->setParameter('mimetype', $mimetypeId) ->setParameter('name', '%' . $this->connection->escapeLikeParameter('.' . $extension)); - $count += $update->execute(); + $count += $update->executeStatement(); } return $count; diff --git a/lib/private/Security/Bruteforce/CleanupJob.php b/lib/private/Security/Bruteforce/CleanupJob.php index 45cfe572acb0a..4405166adfca8 100644 --- a/lib/private/Security/Bruteforce/CleanupJob.php +++ b/lib/private/Security/Bruteforce/CleanupJob.php @@ -51,6 +51,6 @@ protected function run($argument) { $qb = $this->connection->getQueryBuilder(); $qb->delete('bruteforce_attempts') ->where($qb->expr()->lt('occurred', $qb->createNamedParameter($time), IQueryBuilder::PARAM_INT)); - $qb->execute(); + $qb->executeStatement(); } } diff --git a/lib/private/Security/CredentialsManager.php b/lib/private/Security/CredentialsManager.php index 0bddaeda1b0d9..31e8b95d16520 100644 --- a/lib/private/Security/CredentialsManager.php +++ b/lib/private/Security/CredentialsManager.php @@ -92,7 +92,7 @@ public function retrieve(string $userId, string $identifier) { $qb->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($userId))); } - $qResult = $qb->execute(); + $qResult = $qb->executeQuery(); $result = $qResult->fetch(); $qResult->closeCursor(); @@ -122,7 +122,7 @@ public function delete(string $userId, string $identifier): int { $qb->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($userId))); } - return $qb->execute(); + return $qb->executeStatement(); } /** @@ -136,6 +136,6 @@ public function erase(string $userId): int { $qb->delete(self::DB_TABLE) ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId))) ; - return $qb->execute(); + return $qb->executeStatement(); } } diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 50f566728a957..64c79fe524a96 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -122,14 +122,14 @@ private function createDBUser($connection) { if ($connection->getDatabasePlatform() instanceof Mysql80Platform) { $query = "CREATE USER '$name'@'localhost' IDENTIFIED WITH mysql_native_password BY '$password'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); $query = "CREATE USER '$name'@'%' IDENTIFIED WITH mysql_native_password BY '$password'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); } else { $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; - $connection->executeUpdate($query); + $connection->executeStatement($query); } } catch (\Exception $ex) { $this->logger->error('Database user creation failed.', [ diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index 490cbba69a94c..27aa2ded50691 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -56,7 +56,7 @@ public function setupDatabase($username) { ->andWhere($builder->expr()->eq('rolname', $builder->createNamedParameter($this->dbUser))); try { - $result = $query->execute(); + $result = $query->executeQuery(); $canCreateRoles = $result->rowCount() > 0; } catch (DatabaseException $e) { $canCreateRoles = false; @@ -124,7 +124,7 @@ private function createDatabase(Connection $connection) { //The database does not exists... let's create it $query = $connection->prepare("CREATE DATABASE " . addslashes($this->dbName) . " OWNER \"" . addslashes($this->dbUser) . '"'); try { - $query->execute(); + $query->executeStatement(); } catch (DatabaseException $e) { $this->logger->error('Error while trying to create database', [ 'exception' => $e, @@ -133,7 +133,7 @@ private function createDatabase(Connection $connection) { } else { $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC"); try { - $query->execute(); + $query->executeStatement(); } catch (DatabaseException $e) { $this->logger->error('Error while trying to restrict database permissions', [ 'exception' => $e, @@ -148,7 +148,7 @@ private function userExists(Connection $connection) { $query = $builder->select('*') ->from('pg_roles') ->where($builder->expr()->eq('rolname', $builder->createNamedParameter($this->dbUser))); - $result = $query->execute(); + $result = $query->executeQuery(); return $result->rowCount() > 0; } @@ -158,7 +158,7 @@ private function databaseExists(Connection $connection) { $query = $builder->select('datname') ->from('pg_database') ->where($builder->expr()->eq('datname', $builder->createNamedParameter($this->dbName))); - $result = $query->execute(); + $result = $query->executeQuery(); return $result->rowCount() > 0; } @@ -173,10 +173,10 @@ private function createDBUser(Connection $connection) { // create the user $query = $connection->prepare("CREATE USER \"" . addslashes($this->dbUser) . "\" CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); - $query->execute(); + $query->executeStatement(); if ($this->databaseExists($connection)) { $query = $connection->prepare('GRANT CONNECT ON DATABASE ' . addslashes($this->dbName) . ' TO "' . addslashes($this->dbUser) . '"'); - $query->execute(); + $query->executeStatement(); } } catch (DatabaseException $e) { $this->logger->error('Error while trying to create database user', [ diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 3f5d01618ebcb..256854cc80404 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -266,7 +266,7 @@ public function update(\OCP\Share\IShare $share) { ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) ->set('note', $qb->createNamedParameter($share->getNote())) ->set('accepted', $qb->createNamedParameter($share->getStatus())) - ->execute(); + ->executeStatement(); } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') @@ -279,7 +279,7 @@ public function update(\OCP\Share\IShare $share) { ->set('file_source', $qb->createNamedParameter($share->getNode()->getId())) ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) ->set('note', $qb->createNamedParameter($share->getNote())) - ->execute(); + ->executeStatement(); /* * Update all user defined group shares @@ -294,7 +294,7 @@ public function update(\OCP\Share\IShare $share) { ->set('file_source', $qb->createNamedParameter($share->getNode()->getId())) ->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE)) ->set('note', $qb->createNamedParameter($share->getNote())) - ->execute(); + ->executeStatement(); /* * Now update the permissions for all children that have not set it to 0 @@ -305,7 +305,7 @@ public function update(\OCP\Share\IShare $share) { ->andWhere($qb->expr()->neq('permissions', $qb->createNamedParameter(0))) ->set('permissions', $qb->createNamedParameter($share->getPermissions())) ->set('attributes', $qb->createNamedParameter($shareAttributes)) - ->execute(); + ->executeStatement(); } elseif ($share->getShareType() === IShare::TYPE_LINK) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') @@ -323,7 +323,7 @@ public function update(\OCP\Share\IShare $share) { ->set('note', $qb->createNamedParameter($share->getNote())) ->set('label', $qb->createNamedParameter($share->getLabel())) ->set('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0), IQueryBuilder::PARAM_INT) - ->execute(); + ->executeStatement(); } if ($originalShare->getNote() !== $share->getNote() && $share->getNote() !== '') { @@ -366,7 +366,7 @@ public function acceptShare(IShare $share, string $recipient): IShare { $qb->expr()->eq('item_type', $qb->createNamedParameter('file')), $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) - ->execute(); + ->executeQuery(); $data = $stmt->fetch(); $stmt->closeCursor(); @@ -394,7 +394,7 @@ public function acceptShare(IShare $share, string $recipient): IShare { $qb->update('share') ->set('accepted', $qb->createNamedParameter(IShare::STATUS_ACCEPTED)) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) - ->execute(); + ->executeStatement(); return $share; } @@ -429,7 +429,7 @@ public function getChildren(\OCP\Share\IShare $parent) { )) ->orderBy('id'); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($data = $cursor->fetch()) { $children[] = $this->createShare($data); } @@ -456,7 +456,7 @@ public function delete(\OCP\Share\IShare $share) { $qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId()))); } - $qb->execute(); + $qb->executeStatement(); } /** @@ -493,7 +493,7 @@ public function deleteFromSelf(IShare $share, $recipient) { $qb->expr()->eq('item_type', $qb->createNamedParameter('file')), $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) - ->execute(); + ->executeQuery(); $data = $stmt->fetch(); @@ -515,7 +515,7 @@ public function deleteFromSelf(IShare $share, $recipient) { $qb->update('share') ->set('permissions', $qb->createNamedParameter(0)) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) - ->execute(); + ->executeStatement(); } } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { @@ -546,7 +546,7 @@ protected function createUserSpecificGroupShare(IShare $share, string $recipient 'file_target' => $qb->createNamedParameter($share->getTarget()), 'permissions' => $qb->createNamedParameter($share->getPermissions()), 'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()), - ])->execute(); + ])->executeStatement(); return $qb->getLastInsertId(); } @@ -564,7 +564,7 @@ public function restore(IShare $share, string $recipient): IShare { ->where( $qb->expr()->eq('id', $qb->createNamedParameter($share->getId())) ); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $data = $cursor->fetch(); $cursor->closeCursor(); @@ -581,7 +581,7 @@ public function restore(IShare $share, string $recipient): IShare { $qb->expr()->eq('share_with', $qb->createNamedParameter($recipient)) ); - $qb->execute(); + $qb->executeStatement(); return $this->getShareById($share->getId(), $recipient); } @@ -596,7 +596,7 @@ public function move(\OCP\Share\IShare $share, $recipient) { $qb->update('share') ->set('file_target', $qb->createNamedParameter($share->getTarget())) ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) - ->execute(); + ->executeStatement(); } elseif ($share->getShareType() === IShare::TYPE_GROUP) { // Check if there is a usergroup share $qb = $this->dbConn->getQueryBuilder(); @@ -610,7 +610,7 @@ public function move(\OCP\Share\IShare $share, $recipient) { $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $data = $stmt->fetch(); $stmt->closeCursor(); @@ -636,14 +636,14 @@ public function move(\OCP\Share\IShare $share, $recipient) { 'permissions' => $qb->createNamedParameter($share->getPermissions()), 'attributes' => $qb->createNamedParameter($shareAttributes), 'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()), - ])->execute(); + ])->executeStatement(); } else { // Already a usergroup share. Update it. $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->set('file_target', $qb->createNamedParameter($share->getTarget())) ->where($qb->expr()->eq('id', $qb->createNamedParameter($data['id']))) - ->execute(); + ->executeStatement(); } } @@ -771,7 +771,7 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs $qb->setFirstResult($offset); $qb->orderBy('id'); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $shares = []; while ($data = $cursor->fetch()) { $shares[] = $this->createShare($data); @@ -805,7 +805,7 @@ public function getShareById($id, $recipientId = null) { $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $data = $cursor->fetch(); $cursor->closeCursor(); @@ -849,7 +849,7 @@ public function getSharesByPath(Node $path) { $qb->expr()->eq('item_type', $qb->createNamedParameter('file')), $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) - ->execute(); + ->executeQuery(); $shares = []; while ($data = $cursor->fetch()) { @@ -926,7 +926,7 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) { $qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId()))); } - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($data = $cursor->fetch()) { if ($data['fileid'] && $data['path'] === null) { @@ -990,7 +990,7 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) { $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($data = $cursor->fetch()) { if ($offset > 0) { $offset--; @@ -1034,7 +1034,7 @@ public function getShareByToken($token) { $qb->expr()->eq('item_type', $qb->createNamedParameter('file')), $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) - ->execute(); + ->executeQuery(); $data = $cursor->fetch(); @@ -1157,7 +1157,7 @@ private function resolveGroupShares($shares, $userId) { $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )); - $stmt = $query->execute(); + $stmt = $query->executeQuery(); while ($data = $stmt->fetch()) { $shareMap[$data['parent']]->setPermissions((int)$data['permissions']); @@ -1241,7 +1241,7 @@ public function userDeleted($uid, $shareType) { return; } - $qb->execute(); + $qb->executeStatement(); } /** @@ -1260,7 +1260,7 @@ public function groupDeleted($gid) { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid))); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $ids = []; while ($row = $cursor->fetch()) { $ids[] = (int)$row['id']; @@ -1273,7 +1273,7 @@ public function groupDeleted($gid) { $qb->delete('share') ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP))) ->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY))); - $qb->execute(); + $qb->executeStatement(); } } @@ -1284,7 +1284,7 @@ public function groupDeleted($gid) { $qb->delete('share') ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid))); - $qb->execute(); + $qb->executeStatement(); } /** @@ -1303,7 +1303,7 @@ public function userDeletedFromGroup($uid, $gid) { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($gid))); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $ids = []; while ($row = $cursor->fetch()) { $ids[] = (int)$row['id']; @@ -1320,7 +1320,7 @@ public function userDeletedFromGroup($uid, $gid) { ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USERGROUP))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($uid))) ->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY))); - $qb->execute(); + $qb->executeStatement(); } } } @@ -1356,7 +1356,7 @@ public function getAccessList($nodes, $currentAccess) { $qb->expr()->eq('item_type', $qb->createNamedParameter('file')), $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); $users = []; $link = false; @@ -1548,7 +1548,7 @@ public function getAllShares(): iterable { ) ); - $cursor = $qb->execute(); + $cursor = $qb->executeQuery(); while ($data = $cursor->fetch()) { try { $share = $this->createShare($data); diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index 54f14b8ab8870..f6dc3d332b879 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -89,7 +89,7 @@ public function createSubAdmin(IUser $user, IGroup $group): void { 'gid' => $qb->createNamedParameter($group->getGID()), 'uid' => $qb->createNamedParameter($user->getUID()) ]) - ->execute(); + ->executeStatement(); /** @deprecated 21.0.0 - use type SubAdminAddedEvent instead */ $this->emit('\OC\SubAdmin', 'postCreateSubAdmin', [$user, $group]); @@ -108,7 +108,7 @@ public function deleteSubAdmin(IUser $user, IGroup $group): void { $qb->delete('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID()))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) - ->execute(); + ->executeStatement(); /** @deprecated 21.0.0 - use type SubAdminRemovedEvent instead */ $this->emit('\OC\SubAdmin', 'postDeleteSubAdmin', [$user, $group]); @@ -146,7 +146,7 @@ public function getSubAdminsGroupIds(IUser $user): array { $result = $qb->select('gid') ->from('group_admin') ->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) - ->execute(); + ->executeQuery(); $groups = []; while ($row = $result->fetch()) { @@ -179,7 +179,7 @@ public function getGroupsSubAdmins(IGroup $group): array { $result = $qb->select('uid') ->from('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID()))) - ->execute(); + ->executeQuery(); $users = []; while ($row = $result->fetch()) { @@ -202,7 +202,7 @@ public function getAllSubAdmins(): array { $result = $qb->select('*') ->from('group_admin') - ->execute(); + ->executeQuery(); $subadmins = []; while ($row = $result->fetch()) { @@ -236,7 +236,7 @@ public function isSubAdminOfGroup(IUser $user, IGroup $group): bool { ->from('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID()))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) - ->execute(); + ->executeQuery(); $fetch = $result->fetch(); $result->closeCursor(); @@ -262,7 +262,7 @@ public function isSubAdmin(IUser $user): bool { ->from('group_admin') ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) ->setMaxResults(1) - ->execute(); + ->executeQuery(); $isSubAdmin = $result->fetch(); $result->closeCursor(); @@ -299,7 +299,7 @@ private function post_deleteUser(IUser $user) { $qb->delete('group_admin') ->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) - ->execute(); + ->executeStatement(); } /** @@ -311,6 +311,6 @@ private function post_deleteGroup(IGroup $group) { $qb->delete('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID()))) - ->execute(); + ->executeStatement(); } } diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index c52c350b6f810..6746dd756c500 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -94,7 +94,7 @@ public function getTagsByIds($tagIds, ?IUser $user = null): array { ->addOrderBy('editable', 'ASC') ->setParameter('tagids', $tagIds, IQueryBuilder::PARAM_INT_ARRAY); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $tag = $this->createSystemTagFromRow($row); if ($user && !$this->canUserSeeTag($tag, $user)) { @@ -143,7 +143,7 @@ public function getAllTags($visibilityFilter = null, $nameSearchPattern = null): ->addOrderBy('visibility', 'ASC') ->addOrderBy('editable', 'ASC'); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $tags[$row['id']] = $this->createSystemTagFromRow($row); } @@ -163,7 +163,7 @@ public function getTag(string $tagName, bool $userVisible, bool $userAssignable) ->setParameter('name', $truncatedTagName) ->setParameter('visibility', $userVisible ? 1 : 0) ->setParameter('editable', $userAssignable ? 1 : 0) - ->execute(); + ->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -191,7 +191,7 @@ public function createTag(string $tagName, bool $userVisible, bool $userAssignab ]); try { - $query->execute(); + $query->executeStatement(); } catch (UniqueConstraintViolationException $e) { throw new TagAlreadyExistsException( 'Tag ("' . $truncatedTagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', @@ -250,7 +250,7 @@ public function updateTag(string $tagId, string $newName, bool $userVisible, boo ->setParameter('tagid', $tagId); try { - if ($query->execute() === 0) { + if ($query->executeStatement() === 0) { throw new TagNotFoundException( 'Tag does not exist', 0, null, [$tagId] ); @@ -299,13 +299,13 @@ public function deleteTags($tagIds) { $query->delete(SystemTagObjectMapper::RELATION_TABLE) ->where($query->expr()->in('systemtagid', $query->createParameter('tagids'))) ->setParameter('tagids', $tagIds, IQueryBuilder::PARAM_INT_ARRAY) - ->execute(); + ->executeStatement(); $query = $this->connection->getQueryBuilder(); $query->delete(self::TAG_TABLE) ->where($query->expr()->in('id', $query->createParameter('tagids'))) ->setParameter('tagids', $tagIds, IQueryBuilder::PARAM_INT_ARRAY) - ->execute(); + ->executeStatement(); foreach ($tags as $tag) { $this->dispatcher->dispatch(ManagerEvent::EVENT_DELETE, new ManagerEvent( @@ -377,7 +377,7 @@ public function setTagGroups(ISystemTag $tag, array $groupIds) { $query = $this->connection->getQueryBuilder(); $query->delete(self::TAG_GROUP_TABLE) ->where($query->expr()->eq('systemtagid', $query->createNamedParameter($tag->getId()))) - ->execute(); + ->executeStatement(); // add each group id $query = $this->connection->getQueryBuilder(); @@ -391,7 +391,7 @@ public function setTagGroups(ISystemTag $tag, array $groupIds) { continue; } $query->setParameter('gid', $groupId); - $query->execute(); + $query->executeStatement(); } $this->connection->commit(); @@ -412,7 +412,7 @@ public function getTagGroups(ISystemTag $tag): array { ->where($query->expr()->eq('systemtagid', $query->createNamedParameter($tag->getId()))) ->orderBy('gid'); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $groupIds[] = $row['gid']; } diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index 66a21e5860991..743da3b9d9b5a 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -116,7 +116,7 @@ public function getObjectIdsForTags($tagIds, string $objectType, int $limit = 0, $objectIds = []; - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { $objectIds[] = $row['objectid']; } @@ -147,7 +147,7 @@ public function assignTags(string $objId, string $objectType, $tagIds) { foreach ($tagIds as $tagId) { try { $query->setParameter('tagid', $tagId); - $query->execute(); + $query->executeStatement(); $tagsAssigned[] = $tagId; } catch (UniqueConstraintViolationException $e) { // ignore existing relations @@ -184,7 +184,7 @@ public function unassignTags(string $objId, string $objectType, $tagIds) { ->setParameter('objectid', $objId) ->setParameter('objecttype', $objectType) ->setParameter('tagids', $tagIds, IQueryBuilder::PARAM_INT_ARRAY) - ->execute(); + ->executeStatement(); $this->dispatcher->dispatch(MapperEvent::EVENT_UNASSIGN, new MapperEvent( MapperEvent::EVENT_UNASSIGN, @@ -223,7 +223,7 @@ public function haveTag($objIds, string $objectType, string $tagId, bool $all = ->setParameter('tagid', $tagId) ->setParameter('objecttype', $objectType); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(\PDO::FETCH_NUM); $result->closeCursor(); diff --git a/lib/private/TagManager.php b/lib/private/TagManager.php index 82c4dd2188d8d..6e8930ea8adbb 100644 --- a/lib/private/TagManager.php +++ b/lib/private/TagManager.php @@ -95,7 +95,7 @@ public function getUsersFavoritingObject(string $objectType, int $objectId): arr ->andWhere($query->expr()->eq('c.type', $query->createNamedParameter($objectType))) ->andWhere($query->expr()->eq('c.category', $query->createNamedParameter(ITags::TAG_FAVORITE))); - $result = $query->execute(); + $result = $query->executeQuery(); $users = $result->fetchAll(\PDO::FETCH_COLUMN); $result->closeCursor(); diff --git a/lib/private/Updater/ChangesMapper.php b/lib/private/Updater/ChangesMapper.php index 33d50f5844f87..32403d0c02a79 100644 --- a/lib/private/Updater/ChangesMapper.php +++ b/lib/private/Updater/ChangesMapper.php @@ -50,7 +50,7 @@ public function getChanges(string $version): Changes { $result = $qb->select('*') ->from(self::TABLE_NAME) ->where($qb->expr()->eq('version', $qb->createNamedParameter($version))) - ->execute(); + ->executeQuery(); $data = $result->fetch(); $result->closeCursor(); diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 9ef1bc67a58d0..4c5d4fbfd901c 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -163,7 +163,7 @@ public function deleteUser($uid) { $query = $this->dbConn->getQueryBuilder(); $query->delete($this->table) ->where($query->expr()->eq('uid_lower', $query->createNamedParameter(mb_strtolower($uid)))); - $result = $query->execute(); + $result = $query->executeStatement(); if (isset($this->cache[$uid])) { unset($this->cache[$uid]); @@ -177,7 +177,7 @@ private function updatePassword(string $uid, string $passwordHash): bool { $query->update($this->table) ->set('password', $query->createNamedParameter($passwordHash)) ->where($query->expr()->eq('uid_lower', $query->createNamedParameter(mb_strtolower($uid)))); - $result = $query->execute(); + $result = $query->executeStatement(); return $result ? true : false; } @@ -235,7 +235,7 @@ public function setDisplayName(string $uid, string $displayName): bool { $query->update($this->table) ->set('displayname', $query->createNamedParameter($displayName)) ->where($query->expr()->eq('uid_lower', $query->createNamedParameter(mb_strtolower($uid)))); - $query->execute(); + $query->executeStatement(); $this->cache[$uid]['displayname'] = $displayName; @@ -328,7 +328,7 @@ public function searchKnownUsersByDisplayName(string $searcher, string $pattern, ->setMaxResults($limit) ->setFirstResult($offset); - $result = $query->execute(); + $result = $query->executeQuery(); $displayNames = []; while ($row = $result->fetch()) { $displayNames[(string)$row['uid']] = (string)$row['displayname']; @@ -389,7 +389,7 @@ private function loadUser($uid) { 'uid_lower', $qb->createNamedParameter(mb_strtolower($uid)) ) ); - $result = $qb->execute(); + $result = $qb->executeQuery(); $row = $result->fetch(); $result->closeCursor(); diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index fb1afb6582564..e88d6c0866146 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -544,7 +544,7 @@ public function countDisabledUsers(): int { ->andWhere($queryBuilder->expr()->eq('configvalue', $queryBuilder->createNamedParameter('false'), IQueryBuilder::PARAM_STR)); - $result = $queryBuilder->execute(); + $result = $queryBuilder->executeQuery(); $count = $result->fetchOne(); $result->closeCursor(); @@ -574,7 +574,7 @@ public function countDisabledUsersOfGroups(array $groups): int { ->andWhere($queryBuilder->expr()->eq('configvalue', $queryBuilder->createNamedParameter('false'), IQueryBuilder::PARAM_STR)) ->andWhere($queryBuilder->expr()->in('gid', $queryBuilder->createNamedParameter($groups, IQueryBuilder::PARAM_STR_ARRAY))); - $result = $queryBuilder->execute(); + $result = $queryBuilder->executeQuery(); $count = $result->fetchOne(); $result->closeCursor(); @@ -600,7 +600,7 @@ public function countSeenUsers() { ->where($queryBuilder->expr()->eq('appid', $queryBuilder->createNamedParameter('login'))) ->andWhere($queryBuilder->expr()->eq('configkey', $queryBuilder->createNamedParameter('lastLogin'))); - $query = $queryBuilder->execute(); + $query = $queryBuilder->executeQuery(); $result = (int)$query->fetchOne(); $query->closeCursor(); @@ -662,7 +662,7 @@ private function getSeenUserIds($limit = null, $offset = null) { if ($offset !== null) { $queryBuilder->setFirstResult($offset); } - $query = $queryBuilder->execute(); + $query = $queryBuilder->executeQuery(); $result = []; while ($row = $query->fetch()) { diff --git a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php index 6d34babe76af6..3005de33e06f8 100644 --- a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php +++ b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php @@ -77,7 +77,7 @@ public function testRun() { 'appid' => 'core', 'configkey' => 'lang', 'configvalue' => $user['configvalue'], - ])->execute(); + ])->executeStatement(); } // check if test data is written to DB @@ -87,7 +87,7 @@ public function testRun() { ->where($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) ->orderBy('userid') - ->execute(); + ->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); @@ -124,7 +124,7 @@ public function testRun() { ->where($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) ->orderBy('userid') - ->execute(); + ->executeQuery(); $rows = $result->fetchAll(); $result->closeCursor(); @@ -144,7 +144,7 @@ public function testRun() { ->andWhere($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) ->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($user['configvalue']), IQueryBuilder::PARAM_STR)) - ->execute(); + ->executeStatement(); } } diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index fca4e8d830888..08759da581ec4 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -42,7 +42,7 @@ public function testDeleteUserValue() { $config = $this->getConfig(); // preparation - add something to the database - $this->connection->executeUpdate( + $this->connection->executeStatement( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', ['userDelete', 'appDelete', 'keyDelete', 'valueDelete'] @@ -231,7 +231,7 @@ public function testGetUserValue() { ], $result[0]); // drop data from database - but the config option should be cached in the config object - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userGet']); + $this->connection->executeStatement('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userGet']); // testing the caching mechanism $value = $config->getUserValue('userGet', 'appGet', 'keyGet'); @@ -260,7 +260,7 @@ public function testGetUserKeys() { ['userFetch2', 'appFetch', 'keyFetch1', 'value7'] ]; foreach ($data as $entry) { - $this->connection->executeUpdate( + $this->connection->executeStatement( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', $entry @@ -274,7 +274,7 @@ public function testGetUserKeys() { $this->assertEquals(['keyFetch1'], $value); // cleanup - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); + $this->connection->executeStatement('DELETE FROM `*PREFIX*preferences`'); } public function testGetUserValueDefault() { @@ -299,7 +299,7 @@ public function testGetUserValueForUsers() { ['userFetch7', 'appFetch2', 'keyFetch1', 'value7'] ]; foreach ($data as $entry) { - $this->connection->executeUpdate( + $this->connection->executeStatement( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', $entry @@ -323,7 +323,7 @@ public function testGetUserValueForUsers() { ], $value, 'userFetch9 is an non-existent user and should not be shown.'); // cleanup - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); + $this->connection->executeStatement('DELETE FROM `*PREFIX*preferences`'); } public function testDeleteAllUserValues() { @@ -340,7 +340,7 @@ public function testDeleteAllUserValues() { ['userFetch4', 'appFetch2', 'keyFetch1', 'value7'] ]; foreach ($data as $entry) { - $this->connection->executeUpdate( + $this->connection->executeStatement( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', $entry @@ -357,7 +357,7 @@ public function testDeleteAllUserValues() { $this->assertEquals(1, $actualCount, 'After removing `userFetch3` there should be exactly 1 entry left.'); // cleanup - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); + $this->connection->executeStatement('DELETE FROM `*PREFIX*preferences`'); } public function testDeleteAppFromAllUsers() { @@ -374,7 +374,7 @@ public function testDeleteAppFromAllUsers() { ['userFetch6', 'appFetch2', 'keyFetch1', 'value7'] ]; foreach ($data as $entry) { - $this->connection->executeUpdate( + $this->connection->executeStatement( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', $entry @@ -400,7 +400,7 @@ public function testDeleteAppFromAllUsers() { $this->assertEquals(2, $actualCount, 'After removing `appFetch2` there should be exactly 2 entries left.'); // cleanup - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); + $this->connection->executeStatement('DELETE FROM `*PREFIX*preferences`'); } public function testGetUsersForUserValue() { @@ -420,7 +420,7 @@ public function testGetUsersForUserValue() { ['user6', 'appFetch9', 'keyFetch9', 'value9'], ]; foreach ($data as $entry) { - $this->connection->executeUpdate( + $this->connection->executeStatement( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', $entry @@ -431,7 +431,7 @@ public function testGetUsersForUserValue() { $this->assertEquals(['user1', 'user2', 'user6'], $value); // cleanup - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); + $this->connection->executeStatement('DELETE FROM `*PREFIX*preferences`'); } public function testGetUsersForUserValueCaseInsensitive() { diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index d4ae66cb2f1a3..89620e6b6b390 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -36,13 +36,13 @@ protected function setUp(): void { $sql = $this->connection->getQueryBuilder(); $sql->select('*') ->from('appconfig'); - $result = $sql->execute(); + $result = $sql->executeQuery(); $this->originalConfig = $result->fetchAll(); $result->closeCursor(); $sql = $this->connection->getQueryBuilder(); $sql->delete('appconfig'); - $sql->execute(); + $sql->executeStatement(); $this->overwriteService(AppConfig::class, new \OC\AppConfig($this->connection)); @@ -58,66 +58,66 @@ protected function setUp(): void { 'appid' => 'testapp', 'configkey' => 'enabled', 'configvalue' => 'true', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'testapp', 'configkey' => 'installed_version', 'configvalue' => '1.2.3', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'testapp', 'configkey' => 'depends_on', 'configvalue' => 'someapp', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'testapp', 'configkey' => 'deletethis', 'configvalue' => 'deletethis', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'testapp', 'configkey' => 'key', 'configvalue' => 'value', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'someapp', 'configkey' => 'key', 'configvalue' => 'value', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'someapp', 'configkey' => 'otherkey', 'configvalue' => 'othervalue', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => '123456', 'configkey' => 'key', 'configvalue' => 'value', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => '123456', 'configkey' => 'enabled', 'configvalue' => 'false', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'anotherapp', 'configkey' => 'key', 'configvalue' => 'value', - ])->execute(); + ])->executeStatement(); $sql->setParameters([ 'appid' => 'anotherapp', 'configkey' => 'enabled', 'configvalue' => 'false', - ])->execute(); + ])->executeStatement(); } protected function tearDown(): void { $sql = $this->connection->getQueryBuilder(); $sql->delete('appconfig'); - $sql->execute(); + $sql->executeStatement(); $sql = $this->connection->getQueryBuilder(); $sql->insert('appconfig') @@ -131,7 +131,7 @@ protected function tearDown(): void { $sql->setParameter('appid', $configs['appid']) ->setParameter('configkey', $configs['configkey']) ->setParameter('configvalue', $configs['configvalue']); - $sql->execute(); + $sql->executeStatement(); } $this->restoreService(AppConfig::class); @@ -241,7 +241,7 @@ public function testDeleteKey() { ->andWhere($sql->expr()->eq('configkey', $sql->createParameter('configkey'))) ->setParameter('appid', 'testapp') ->setParameter('configkey', 'deletethis'); - $query = $sql->execute(); + $query = $sql->executeQuery(); $result = $query->fetch(); $query->closeCursor(); $this->assertFalse($result); @@ -261,7 +261,7 @@ public function testDeleteApp() { ->from('appconfig') ->where($sql->expr()->eq('appid', $sql->createParameter('appid'))) ->setParameter('appid', 'someapp'); - $query = $sql->execute(); + $query = $sql->executeQuery(); $result = $query->fetch(); $query->closeCursor(); $this->assertFalse($result); @@ -283,7 +283,7 @@ public function testGetValues() { ->from('appconfig') ->where($sql->expr()->eq('appid', $sql->createParameter('appid'))) ->setParameter('appid', 'testapp'); - $query = $sql->execute(); + $query = $sql->executeQuery(); $expected = []; while ($row = $query->fetch()) { $expected[$row['configkey']] = $row['configvalue']; @@ -298,7 +298,7 @@ public function testGetValues() { ->from('appconfig') ->where($sql->expr()->eq('configkey', $sql->createParameter('configkey'))) ->setParameter('configkey', 'enabled'); - $query = $sql->execute(); + $query = $sql->executeQuery(); $expected = []; while ($row = $query->fetch()) { $expected[$row['appid']] = $row['configvalue']; @@ -359,7 +359,7 @@ protected function assertConfigKey($app, $key, $expected) { ->andWhere($sql->expr()->eq('configkey', $sql->createParameter('configkey'))) ->setParameter('appid', $app) ->setParameter('configkey', $key); - $query = $sql->execute(); + $query = $sql->executeQuery(); $actual = $query->fetch(); $query->closeCursor(); diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php index 68962b26931e6..d6d8b539326a4 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php @@ -59,7 +59,7 @@ protected function setUp(): void { private function resetDatabase() { $qb = $this->dbConnection->getQueryBuilder(); - $qb->delete('authtoken')->execute(); + $qb->delete('authtoken')->executeStatement(); $qb->insert('authtoken')->values([ 'uid' => $qb->createNamedParameter('user1'), 'login_name' => $qb->createNamedParameter('User1'), @@ -72,7 +72,7 @@ private function resetDatabase() { 'public_key' => $qb->createNamedParameter('public key'), 'private_key' => $qb->createNamedParameter('private key'), 'version' => $qb->createNamedParameter(2), - ])->execute(); + ])->executeStatement(); $qb->insert('authtoken')->values([ 'uid' => $qb->createNamedParameter('user2'), 'login_name' => $qb->createNamedParameter('User2'), @@ -85,7 +85,7 @@ private function resetDatabase() { 'public_key' => $qb->createNamedParameter('public key'), 'private_key' => $qb->createNamedParameter('private key'), 'version' => $qb->createNamedParameter(2), - ])->execute(); + ])->executeStatement(); $qb->insert('authtoken')->values([ 'uid' => $qb->createNamedParameter('user1'), 'login_name' => $qb->createNamedParameter('User1'), @@ -98,7 +98,7 @@ private function resetDatabase() { 'public_key' => $qb->createNamedParameter('public key'), 'private_key' => $qb->createNamedParameter('private key'), 'version' => $qb->createNamedParameter(2), - ])->execute(); + ])->executeStatement(); $qb->insert('authtoken')->values([ 'uid' => $qb->createNamedParameter('user3'), 'login_name' => $qb->createNamedParameter('User3'), @@ -112,7 +112,7 @@ private function resetDatabase() { 'private_key' => $qb->createNamedParameter('private key'), 'version' => $qb->createNamedParameter(2), 'password_invalid' => $qb->createNamedParameter(1), - ])->execute(); + ])->executeStatement(); $qb->insert('authtoken')->values([ 'uid' => $qb->createNamedParameter('user3'), 'login_name' => $qb->createNamedParameter('User3'), @@ -126,14 +126,14 @@ private function resetDatabase() { 'private_key' => $qb->createNamedParameter('private key'), 'version' => $qb->createNamedParameter(2), 'password_invalid' => $qb->createNamedParameter(1), - ])->execute(); + ])->executeStatement(); } private function getNumberOfTokens() { $qb = $this->dbConnection->getQueryBuilder(); $result = $qb->select($qb->func()->count('*', 'count')) ->from('authtoken') - ->execute() + ->executeQuery() ->fetch(); return (int) $result['count']; } @@ -256,7 +256,7 @@ public function testDeleteById() { $qb->select('id') ->from('authtoken') ->where($qb->expr()->eq('token', $qb->createNamedParameter('9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206'))); - $result = $qb->execute(); + $result = $qb->executeQuery(); $id = $result->fetch()['id']; $this->mapper->deleteById('user1', (int)$id); @@ -277,7 +277,7 @@ public function testDeleteByName() { $qb->select('name') ->from('authtoken') ->where($qb->expr()->eq('token', $qb->createNamedParameter('9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206'))); - $result = $qb->execute(); + $result = $qb->executeQuery(); $name = $result->fetch()['name']; $this->mapper->deleteByName($name); $this->assertEquals(4, $this->getNumberOfTokens()); diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php index 4f1b8d25b58be..bb6e87324c7c6 100644 --- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php @@ -47,7 +47,7 @@ protected function setUp(): void { $this->dbConn = OC::$server->getDatabaseConnection(); $qb = $this->dbConn->getQueryBuilder(); $q = $qb->delete(ProviderUserAssignmentDao::TABLE_NAME); - $q->execute(); + $q->executeStatement(); $this->dao = new ProviderUserAssignmentDao($this->dbConn); } @@ -59,13 +59,13 @@ public function testGetState() { 'uid' => $qb->createNamedParameter('user123'), 'enabled' => $qb->createNamedParameter(1), ]); - $q1->execute(); + $q1->executeStatement(); $q2 = $qb->insert(ProviderUserAssignmentDao::TABLE_NAME)->values([ 'provider_id' => $qb->createNamedParameter('twofactor_totp'), 'uid' => $qb->createNamedParameter('user123'), 'enabled' => $qb->createNamedParameter(0), ]); - $q2->execute(); + $q2->executeStatement(); $expected = [ 'twofactor_u2f' => true, 'twofactor_totp' => false, @@ -87,7 +87,7 @@ public function testPersist() { ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter('twofactor_totp'))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123'))) ->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(0))); - $res = $q->execute(); + $res = $q->executeQuery(); $data = $res->fetchAll(); $res->closeCursor(); $this->assertCount(1, $data); @@ -105,7 +105,7 @@ public function testPersistTwice() { ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter('twofactor_totp'))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123'))) ->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(1))); - $res = $q->execute(); + $res = $q->executeQuery(); $data = $res->fetchAll(); $res->closeCursor(); @@ -124,7 +124,7 @@ public function testPersistSameStateTwice() { ->where($qb->expr()->eq('provider_id', $qb->createNamedParameter('twofactor_totp'))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter('user123'))) ->andWhere($qb->expr()->eq('enabled', $qb->createNamedParameter(1))); - $res = $q->execute(); + $res = $q->executeQuery(); $data = $res->fetchAll(); $res->closeCursor(); diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php index 32ee1e79a5ed9..15e112408bb18 100644 --- a/tests/lib/BackgroundJob/JobListTest.php +++ b/tests/lib/BackgroundJob/JobListTest.php @@ -53,7 +53,7 @@ protected function setUp(): void { protected function clearJobsList() { $query = $this->connection->getQueryBuilder(); $query->delete('jobs'); - $query->execute(); + $query->executeStatement(); } protected function getAllSorted() { @@ -168,7 +168,7 @@ protected function createTempJob($class, $argument, $reservedTime = 0, $lastChec 'last_checked' => $query->createNamedParameter($lastChecked, IQueryBuilder::PARAM_INT), 'reserved_at' => $query->createNamedParameter($reservedTime, IQueryBuilder::PARAM_INT), ]); - $query->execute(); + $query->executeStatement(); } public function testGetNext() { diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index 5fa1beee3742e..9eed954847414 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -66,7 +66,7 @@ protected function addDatabaseEntry($parentId, $topmostParentId, $creationDT = n 'object_id' => $qb->createNamedParameter($objectId), 'expire_date' => $qb->createNamedParameter($expireDate, 'datetime'), ]) - ->execute(); + ->executeStatement(); return $qb->getLastInsertId(); } @@ -120,7 +120,7 @@ public function testGetComment() { 'object_type' => $qb->createNamedParameter('files'), 'object_id' => $qb->createNamedParameter('file64'), ]) - ->execute(); + ->executeStatement(); $id = strval($qb->getLastInsertId()); @@ -337,7 +337,7 @@ public function testGetNumberOfUnreadCommentsForFolder() { $fileIds = []; for ($i = 0; $i < 4; $i++) { $query->setParameter('path', 'path_' . $i); - $query->execute(); + $query->executeStatement(); $fileIds[] = $query->getLastInsertId(); } diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php index 35d8b4faa343a..49a606412574a 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php @@ -68,7 +68,7 @@ public function testLike($param1, $param2, $match) { ->from('users') ->where($query->expr()->like($query->createNamedParameter($param1), $query->createNamedParameter($param2))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals($match, $column); @@ -105,7 +105,7 @@ public function testILike($param1, $param2, $match) { ->from('users') ->where($query->expr()->iLike($query->createNamedParameter($param1), $query->createNamedParameter($param2))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals($match, $column); @@ -158,6 +158,6 @@ protected function createConfig($appId, $key, $value) { 'configkey' => $query->createNamedParameter((string) $key), 'configvalue' => $query->createNamedParameter((string) $value), ]) - ->execute(); + ->executeStatement(); } } diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php index 76d9dab75ee36..142ced5053ae7 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php @@ -413,7 +413,7 @@ public function testClobComparisons($function, $value, $type, $compareKeyToValue $query->andWhere(call_user_func([$query->expr(), $function], 'configkey', 'configvalue', IQueryBuilder::PARAM_STR)); } - $result = $query->execute(); + $result = $query->executeQuery(); $this->assertEquals(['count' => $expected], $result->fetch()); $result->closeCursor(); @@ -421,7 +421,7 @@ public function testClobComparisons($function, $value, $type, $compareKeyToValue $query = $this->connection->getQueryBuilder(); $query->delete('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter($appId))) - ->execute(); + ->executeStatement(); } protected function createConfig($appId, $key, $value) { @@ -432,6 +432,6 @@ protected function createConfig($appId, $key, $value) { 'configkey' => $query->createNamedParameter((string) $key), 'configvalue' => $query->createNamedParameter((string) $value), ]) - ->execute(); + ->executeStatement(); } } diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index 08392b09d8dd2..1825b2b6ba36d 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -56,7 +56,7 @@ public function testConcatString($closure) { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals($return, $column); @@ -132,7 +132,7 @@ public function testGroupConcatWithoutSeparator(): void { ->from('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter('group_concat'))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertStringContainsString(',', $column); @@ -148,7 +148,7 @@ public function testGroupConcatWithSeparator(): void { ->from('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter('group_concat'))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertStringContainsString('#', $column); @@ -164,7 +164,7 @@ public function testGroupConcatWithSingleQuoteSeparator(): void { ->from('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter('group_concat'))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertStringContainsString("'", $column); @@ -180,7 +180,7 @@ public function testGroupConcatWithDoubleQuoteSeparator(): void { ->from('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter('group_concat'))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertStringContainsString('"', $column); @@ -221,7 +221,7 @@ public function testIntGroupConcatWithoutSeparator(): void { ->from('systemtag') ->where($query->expr()->eq('name', $query->createNamedParameter('group_concat'))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertStringContainsString(',', $column); @@ -237,7 +237,7 @@ public function testIntGroupConcatWithSeparator(): void { ->from('systemtag') ->where($query->expr()->eq('name', $query->createNamedParameter('group_concat'))); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertStringContainsString('#', $column); @@ -252,7 +252,7 @@ public function testMd5() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(md5('foobar'), $column); @@ -265,7 +265,7 @@ public function testSubstring() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals('oo', $column); @@ -278,7 +278,7 @@ public function testSubstringNoLength() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals('oobar', $column); @@ -291,7 +291,7 @@ public function testLower() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals('foobar', $column); @@ -304,7 +304,7 @@ public function testAdd() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(3, $column); @@ -317,7 +317,7 @@ public function testSubtract() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(1, $column); @@ -330,7 +330,7 @@ public function testCount() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertGreaterThan(1, $column); @@ -355,7 +355,7 @@ public function testOctetLength(string $str, int $bytes) { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals($bytes, $column); @@ -380,7 +380,7 @@ public function testCharLength(string $str, int $bytes) { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $column = $result->fetchOne(); $result->closeCursor(); $this->assertEquals($bytes, $column); @@ -395,7 +395,7 @@ private function setUpMinMax($value) { 'configkey' => $query->createNamedParameter(uniqid()), 'configvalue' => $query->createNamedParameter((string)$value), ]); - $query->execute(); + $query->executeStatement(); } private function clearMinMax() { @@ -403,7 +403,7 @@ private function clearMinMax() { $query->delete('appconfig') ->where($query->expr()->eq('appid', $query->createNamedParameter('minmax'))); - $query->execute(); + $query->executeStatement(); } public function testMaxEmpty() { @@ -416,7 +416,7 @@ public function testMaxEmpty() { ->where($query->expr()->eq('appid', $query->createNamedParameter('minmax'))) ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(null, $row); @@ -432,7 +432,7 @@ public function testMinEmpty() { ->where($query->expr()->eq('appid', $query->createNamedParameter('minmax'))) ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(null, $row); @@ -451,7 +451,7 @@ public function testMax() { ->where($query->expr()->eq('appid', $query->createNamedParameter('minmax'))) ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(20, $row); @@ -470,7 +470,7 @@ public function testMin() { ->where($query->expr()->eq('appid', $query->createNamedParameter('minmax'))) ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(10, $row); @@ -483,7 +483,7 @@ public function testGreatest() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(2, $row); @@ -496,7 +496,7 @@ public function testLeast() { $query->from('appconfig') ->setMaxResults(1); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetchOne(); $result->closeCursor(); $this->assertEquals(1, $row); diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index 6e9a7a849253a..73895d795f751 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -70,7 +70,7 @@ protected function createTestingRows($appId = 'testFirstResult') { 'configkey' => $qB->expr()->literal('testing' . $i), 'configvalue' => $qB->expr()->literal(100 - $i), ]) - ->execute(); + ->executeStatement(); } } @@ -98,7 +98,7 @@ protected function deleteTestingRows($appId = 'testFirstResult') { $qB->delete('*PREFIX*appconfig') ->where($qB->expr()->eq('appid', $qB->expr()->literal($appId))) - ->execute(); + ->executeStatement(); } public function dataFirstResult() { @@ -1190,7 +1190,7 @@ public function testGetLastInsertId() { 'propertyname' => $qB->expr()->literal('testing'), 'propertyvalue' => $qB->expr()->literal('testing'), ]) - ->execute(); + ->executeStatement(); $actual = $qB->getLastInsertId(); @@ -1200,7 +1200,7 @@ public function testGetLastInsertId() { $qB->delete('properties') ->where($qB->expr()->eq('userid', $qB->expr()->literal('testFirstResult'))) - ->execute(); + ->executeStatement(); try { $qB->getLastInsertId(); diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index e4c052f602527..c26434a1152bd 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -341,7 +341,7 @@ public function testRepairParent() { $query = OC::$server->getDatabaseConnection()->getQueryBuilder(); $query->delete('filecache') ->where($query->expr()->eq('fileid', $query->createNamedParameter($oldFolderId))); - $query->execute(); + $query->executeStatement(); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); @@ -367,7 +367,7 @@ public function testRepairParentShallow() { $query = OC::$server->getDatabaseConnection()->getQueryBuilder(); $query->delete('filecache') ->where($query->expr()->eq('fileid', $query->createNamedParameter($oldFolderId))); - $query->execute(); + $query->executeStatement(); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); diff --git a/tests/lib/Files/Cache/SearchBuilderTest.php b/tests/lib/Files/Cache/SearchBuilderTest.php index 5eb1a0252f0d3..683220f31290d 100644 --- a/tests/lib/Files/Cache/SearchBuilderTest.php +++ b/tests/lib/Files/Cache/SearchBuilderTest.php @@ -91,7 +91,7 @@ protected function tearDown(): void { $builder->delete('filecache') ->where($builder->expr()->eq('storage', $builder->createNamedParameter($this->numericStorageId, IQueryBuilder::PARAM_INT))); - $builder->execute(); + $builder->executeStatement(); } private function addCacheEntry(array $data) { @@ -128,7 +128,7 @@ private function addCacheEntry(array $data) { $builder->insert('filecache') ->values($values) - ->execute(); + ->executeStatement(); return $builder->getLastInsertId(); } @@ -137,7 +137,7 @@ private function search(ISearchOperator $operator) { $dbOperator = $this->searchBuilder->searchOperatorToDBExpr($this->builder, $operator); $this->builder->andWhere($dbOperator); - $result = $this->builder->execute(); + $result = $this->builder->executeQuery(); $rows = $result->fetchAll(\PDO::FETCH_COLUMN); $result->closeCursor(); diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index ccad4671ae91a..ab672f260b062 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -73,14 +73,14 @@ protected function setUp(): void { protected function tearDown(): void { $builder = $this->connection->getQueryBuilder(); - $builder->delete('mounts')->execute(); + $builder->delete('mounts')->executeStatement(); $builder = $this->connection->getQueryBuilder(); foreach ($this->fileIds as $fileId) { $builder->delete('filecache') ->where($builder->expr()->eq('fileid', new Literal($fileId))) - ->execute(); + ->executeStatement(); } } diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php index fd3ec552dd249..d79661f146ce5 100644 --- a/tests/lib/Files/Type/LoaderTest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -41,7 +41,7 @@ protected function tearDown(): void { ->where($deleteMimetypes->expr()->like( 'mimetype', $deleteMimetypes->createPositionalParameter('testing/%') )); - $deleteMimetypes->execute(); + $deleteMimetypes->executeStatement(); } @@ -51,7 +51,7 @@ public function testGetMimetype() { ->values([ 'mimetype' => $qb->createPositionalParameter('testing/mymimetype') ]); - $qb->execute(); + $qb->executeStatement(); $this->assertTrue($this->loader->exists('testing/mymimetype')); $mimetypeId = $this->loader->getId('testing/mymimetype'); @@ -76,7 +76,7 @@ public function testStore() { ->from('mimetypes') ->where($qb->expr()->eq('id', $qb->createPositionalParameter($mimetypeId))); - $result = $qb->execute(); + $result = $qb->executeQuery(); $mimetype = $result->fetch(); $result->closeCursor(); $this->assertEquals('testing/mymimetype', $mimetype['mimetype']); diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php index 860e8d73cf083..4e5a30ea4524c 100644 --- a/tests/lib/Lock/DBLockingProviderTest.php +++ b/tests/lib/Lock/DBLockingProviderTest.php @@ -103,7 +103,7 @@ protected function getLockValue($key) { ->from('file_locks') ->where($query->expr()->eq('key', $query->createNamedParameter($key))); - $result = $query->execute(); + $result = $query->executeQuery(); $rows = $result->fetchOne(); $result->closeCursor(); diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php index 9fc3ef1715034..4f339ebb817e6 100644 --- a/tests/lib/Repair/CleanTagsTest.php +++ b/tests/lib/Repair/CleanTagsTest.php @@ -60,13 +60,13 @@ protected function tearDown(): void { protected function cleanUpTables() { $qb = $this->connection->getQueryBuilder(); $qb->delete('vcategory') - ->execute(); + ->executeStatement(); $qb->delete('vcategory_to_object') - ->execute(); + ->executeStatement(); $qb->delete('filecache') - ->execute(); + ->executeStatement(); } public function testRun() { @@ -119,7 +119,7 @@ protected function assertEntryCount($tableName, $expected, $message = '') { $qb = $this->connection->getQueryBuilder(); $result = $qb->select($qb->func()->count('*')) ->from($tableName) - ->execute(); + ->executeQuery(); $this->assertEquals($expected, $result->fetchOne(), $message); } @@ -140,7 +140,7 @@ protected function addTagCategory($category, $type, $user = 'TestRepairCleanTags 'category' => $qb->createNamedParameter($category), 'type' => $qb->createNamedParameter($type), ]) - ->execute(); + ->executeStatement(); return (int) $this->getLastInsertID('vcategory', 'id'); } @@ -159,7 +159,7 @@ protected function addTagEntry($objectId, $category, $type) { 'categoryid' => $qb->createNamedParameter($category, IQueryBuilder::PARAM_INT), 'type' => $qb->createNamedParameter($type), ]) - ->execute(); + ->executeStatement(); } /** @@ -180,14 +180,14 @@ protected function getFileID() { 'path' => $qb->createNamedParameter($fileName), 'path_hash' => $qb->createNamedParameter(md5($fileName)), ]) - ->execute(); + ->executeStatement(); $fileName = $this->getUniqueID('TestRepairCleanTags', 12); $qb->insert('filecache') ->values([ 'path' => $qb->createNamedParameter($fileName), 'path_hash' => $qb->createNamedParameter(md5($fileName)), ]) - ->execute(); + ->executeStatement(); $this->createdFile = (int) $this->getLastInsertID('filecache', 'fileid'); return $this->createdFile; diff --git a/tests/lib/Repair/NC11/FixMountStoragesTest.php b/tests/lib/Repair/NC11/FixMountStoragesTest.php index 843cc31392cab..4bc04381a6d20 100644 --- a/tests/lib/Repair/NC11/FixMountStoragesTest.php +++ b/tests/lib/Repair/NC11/FixMountStoragesTest.php @@ -97,7 +97,7 @@ protected function createFile($storage) { 'size' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT), 'unencrypted_size' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT), ]); - $query->execute(); + $query->executeStatement(); return $query->getLastInsertId(); } @@ -112,7 +112,7 @@ protected function createMount($fileId, $storage) { 'user_id' => $query->createNamedParameter(static::getUniqueID(), IQueryBuilder::PARAM_STR), 'mount_point' => $query->createNamedParameter(static::getUniqueID(), IQueryBuilder::PARAM_STR), ]); - $query->execute(); + $query->executeStatement(); return $query->getLastInsertId(); } @@ -122,7 +122,7 @@ protected function assertStorage($mount, $storage) { $query->select('storage_id') ->from('mounts') ->where($query->expr()->eq('id', $query->createNamedParameter($mount, IQueryBuilder::PARAM_INT))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php index 7ebc12732d600..199d02c6390ca 100644 --- a/tests/lib/Repair/OldGroupMembershipSharesTest.php +++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php @@ -49,7 +49,7 @@ protected function tearDown(): void { protected function deleteAllShares() { $qb = $this->connection->getQueryBuilder(); - $qb->delete('share')->execute(); + $qb->delete('share')->executeStatement(); } public function testRun() { @@ -77,7 +77,7 @@ public function testRun() { $result = $query->select('id') ->from('share') ->orderBy('id', 'ASC') - ->execute(); + ->executeQuery(); $rows = $result->fetchAll(); $this->assertEquals([['id' => $parent], ['id' => $group2], ['id' => $user1], ['id' => $member], ['id' => $notAMember]], $rows); $result->closeCursor(); @@ -93,7 +93,7 @@ public function testRun() { $result = $query->select('id') ->from('share') ->orderBy('id', 'ASC') - ->execute(); + ->executeQuery(); $rows = $result->fetchAll(); $this->assertEquals([['id' => $parent], ['id' => $group2], ['id' => $user1], ['id' => $member]], $rows); $result->closeCursor(); @@ -128,7 +128,7 @@ protected function createShare($shareType, $shareWith, $parent) { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') ->values($shareValues) - ->execute(); + ->executeStatement(); return $this->connection->lastInsertId('*PREFIX*share'); } diff --git a/tests/lib/Repair/RepairDavSharesTest.php b/tests/lib/Repair/RepairDavSharesTest.php index 394fc9854690d..22fabf146e096 100644 --- a/tests/lib/Repair/RepairDavSharesTest.php +++ b/tests/lib/Repair/RepairDavSharesTest.php @@ -152,7 +152,7 @@ public function testRun() { ->method('where') ->willReturnSelf(); $selectMock->expects($this->once()) - ->method('execute') + ->method('executeQuery') ->willReturn($shareResults); $updateMock = $this->createMock(IQueryBuilder::class); @@ -178,7 +178,7 @@ public function testRun() { ) ->willReturnSelf(); $updateMock->expects($this->exactly(2)) - ->method('execute'); + ->method('executeStatement'); $this->dbc->expects($this->atLeast(2)) ->method('getQueryBuilder') diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index 486e11230b847..9752225024d08 100644 --- a/tests/lib/Repair/RepairInvalidSharesTest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php @@ -55,7 +55,7 @@ protected function tearDown(): void { protected function deleteAllShares() { $qb = $this->connection->getQueryBuilder(); - $qb->delete('share')->execute(); + $qb->delete('share')->executeStatement(); } /** @@ -81,7 +81,7 @@ public function testSharesNonExistingParent() { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') ->values($shareValues) - ->execute(); + ->executeStatement(); $parent = $this->getLastShareId(); // share with existing parent @@ -89,7 +89,7 @@ public function testSharesNonExistingParent() { $qb->insert('share') ->values(array_merge($shareValues, [ 'parent' => $qb->expr()->literal($parent), - ]))->execute(); + ]))->executeStatement(); $validChild = $this->getLastShareId(); // share with non-existing parent @@ -97,14 +97,14 @@ public function testSharesNonExistingParent() { $qb->insert('share') ->values(array_merge($shareValues, [ 'parent' => $qb->expr()->literal($parent + 100), - ]))->execute(); + ]))->executeStatement(); $invalidChild = $this->getLastShareId(); $query = $this->connection->getQueryBuilder(); $result = $query->select('id') ->from('share') ->orderBy('id', 'ASC') - ->execute(); + ->executeQuery(); $rows = $result->fetchAll(); $this->assertEquals([['id' => $parent], ['id' => $validChild], ['id' => $invalidChild]], $rows); $result->closeCursor(); @@ -120,7 +120,7 @@ public function testSharesNonExistingParent() { $result = $query->select('id') ->from('share') ->orderBy('id', 'ASC') - ->execute(); + ->executeQuery(); $rows = $result->fetchAll(); $this->assertEquals([['id' => $parent], ['id' => $validChild]], $rows); $result->closeCursor(); @@ -168,7 +168,7 @@ public function testFileSharePermissions($itemType, $testPerms, $expectedPerms) 'permissions' => $qb->expr()->literal($testPerms), 'stime' => $qb->expr()->literal(time()), ]) - ->execute(); + ->executeStatement(); $shareId = $this->getLastShareId(); @@ -183,7 +183,7 @@ public function testFileSharePermissions($itemType, $testPerms, $expectedPerms) ->select('*') ->from('share') ->orderBy('permissions', 'ASC') - ->execute() + ->executeQuery() ->fetchAll(); $this->assertCount(1, $results); diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index 61cf58582414e..c03baf9131940 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -57,7 +57,7 @@ protected function tearDown(): void { $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $qb->delete('storages') ->where($qb->expr()->eq('id', $qb->createNamedParameter($this->storage->getId()))); - $qb->execute(); + $qb->executeStatement(); $this->clearMimeTypes(); @@ -67,7 +67,7 @@ protected function tearDown(): void { private function clearMimeTypes() { $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $qb->delete('mimetypes'); - $qb->execute(); + $qb->executeStatement(); $this->mimetypeLoader->reset(); } diff --git a/tests/lib/Repair/RepairSqliteAutoincrementTest.php b/tests/lib/Repair/RepairSqliteAutoincrementTest.php index b4be47d015735..9c60621238cb5 100644 --- a/tests/lib/Repair/RepairSqliteAutoincrementTest.php +++ b/tests/lib/Repair/RepairSqliteAutoincrementTest.php @@ -48,7 +48,7 @@ protected function setUp(): void { $dbPrefix = $this->config->getSystemValueString('dbtableprefix', 'oc_'); $this->tableName = $this->getUniqueID($dbPrefix . 'autoinc_test'); - $this->connection->prepare('CREATE TABLE ' . $this->tableName . '("someid" INTEGER NOT NULL, "text" VARCHAR(16), PRIMARY KEY("someid"))')->execute(); + $this->connection->prepare('CREATE TABLE ' . $this->tableName . '("someid" INTEGER NOT NULL, "text" VARCHAR(16), PRIMARY KEY("someid"))')->executeStatement(); $this->repair = new \OC\Repair\SqliteAutoincrement($this->connection); } diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 0ce96102a30d2..a307f9a5bc1b2 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -98,7 +98,7 @@ protected function setUp(): void { $this->timeFactory->expects($this->any())->method('now')->willReturn(new \DateTimeImmutable("2023-05-04 00:00 Europe/Berlin")); //Empty share table - $this->dbConn->getQueryBuilder()->delete('share')->execute(); + $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); $this->provider = new DefaultShareProvider( $this->dbConn, @@ -114,9 +114,9 @@ protected function setUp(): void { } protected function tearDown(): void { - $this->dbConn->getQueryBuilder()->delete('share')->execute(); - $this->dbConn->getQueryBuilder()->delete('filecache')->execute(); - $this->dbConn->getQueryBuilder()->delete('storages')->execute(); + $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); + $this->dbConn->getQueryBuilder()->delete('filecache')->executeStatement(); + $this->dbConn->getQueryBuilder()->delete('storages')->executeStatement(); } /** @@ -172,7 +172,7 @@ private function addShareToDB($shareType, $sharedWith, $sharedBy, $shareOwner, $qb->setValue('parent', $qb->expr()->literal($parent)); } - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); return$qb->getLastInsertId(); } @@ -199,7 +199,7 @@ public function testGetShareByIdUserShare() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $qb->execute(); + $qb->executeStatement(); $id = $qb->getLastInsertId(); @@ -246,7 +246,7 @@ public function testGetShareByIdLazy() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $qb->execute(); + $qb->executeStatement(); $id = $qb->getLastInsertId(); @@ -281,7 +281,7 @@ public function testGetShareByIdLazy2() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $qb->execute(); + $qb->executeStatement(); $id = $qb->getLastInsertId(); @@ -325,7 +325,7 @@ public function testGetShareByIdGroupShare() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); // Get the id $id = $qb->getLastInsertId(); @@ -410,7 +410,7 @@ public function testGetShareByIdLinkShare() { 'token' => $qb->expr()->literal('token'), 'expiration' => $qb->expr()->literal('2000-01-02 00:00:00'), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); @@ -452,7 +452,7 @@ public function testDeleteSingleShare() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); @@ -501,7 +501,7 @@ public function testDeleteSingleShareLazy() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); @@ -533,7 +533,7 @@ public function testDeleteGroupShareWithUserGroupShares() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); $qb = $this->dbConn->getQueryBuilder(); @@ -548,7 +548,7 @@ public function testDeleteGroupShareWithUserGroupShares() { 'permissions' => $qb->expr()->literal(13), 'parent' => $qb->expr()->literal($id), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $share = $this->createMock(IShare::class); $share->method('getId')->willReturn($id); @@ -596,7 +596,7 @@ public function testGetChildren() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $qb->execute(); + $qb->executeStatement(); // Get the id $id = $qb->getLastInsertId(); @@ -614,7 +614,7 @@ public function testGetChildren() { 'permissions' => $qb->expr()->literal(2), 'parent' => $qb->expr()->literal($id), ]); - $qb->execute(); + $qb->executeStatement(); $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') @@ -629,7 +629,7 @@ public function testGetChildren() { 'permissions' => $qb->expr()->literal(4), 'parent' => $qb->expr()->literal($id), ]); - $qb->execute(); + $qb->executeStatement(); $ownerPath = $this->createMock(Folder::class); $ownerFolder = $this->createMock(Folder::class); @@ -884,7 +884,7 @@ public function testGetShareByToken() { 'permissions' => $qb->expr()->literal(13), 'token' => $qb->expr()->literal('secrettoken'), ]); - $qb->execute(); + $qb->executeStatement(); $id = $qb->getLastInsertId(); $file = $this->createMock(File::class); @@ -915,7 +915,7 @@ private function createTestStorageEntry($storageStringId) { ->values([ 'id' => $qb->expr()->literal($storageStringId), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); return $qb->getLastInsertId(); } @@ -928,7 +928,7 @@ private function createTestFileEntry($path, $storage = 1) { 'path_hash' => $qb->expr()->literal(md5($path)), 'name' => $qb->expr()->literal(basename($path)), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); return $qb->getLastInsertId(); } @@ -962,7 +962,7 @@ public function testGetSharedWithUser($storageStringId, $fileName1, $fileName2) 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); $qb = $this->dbConn->getQueryBuilder(); @@ -977,7 +977,7 @@ public function testGetSharedWithUser($storageStringId, $fileName1, $fileName2) 'file_target' => $qb->expr()->literal('myTarget2'), 'permissions' => $qb->expr()->literal(14), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $file = $this->createMock(File::class); $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); @@ -1013,7 +1013,7 @@ public function testGetSharedWithGroup($storageStringId, $fileName1, $fileName2) 'file_target' => $qb->expr()->literal('myTarget2'), 'permissions' => $qb->expr()->literal(14), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') @@ -1027,7 +1027,7 @@ public function testGetSharedWithGroup($storageStringId, $fileName1, $fileName2) 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); $groups = []; @@ -1084,7 +1084,7 @@ public function testGetSharedWithGroupUserModified($storageStringId, $fileName1, 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); /* @@ -1103,7 +1103,7 @@ public function testGetSharedWithGroupUserModified($storageStringId, $fileName1, 'permissions' => $qb->expr()->literal(31), 'parent' => $qb->expr()->literal($id), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); /* * Correct share. should be taken by code path. @@ -1121,7 +1121,7 @@ public function testGetSharedWithGroupUserModified($storageStringId, $fileName1, 'permissions' => $qb->expr()->literal(0), 'parent' => $qb->expr()->literal($id), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $groups = ['sharedWith']; @@ -1272,7 +1272,7 @@ public function testGetSharedWithWithDeletedFile($shareType, $trashed) { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $file = $this->createMock(File::class); $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); @@ -1316,7 +1316,7 @@ public function testGetSharesBy() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); $qb = $this->dbConn->getQueryBuilder(); @@ -1332,7 +1332,7 @@ public function testGetSharesBy() { 'permissions' => $qb->expr()->literal(0), 'parent' => $qb->expr()->literal($id), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $file = $this->createMock(File::class); $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); @@ -1365,7 +1365,7 @@ public function testGetSharesNode() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id = $qb->getLastInsertId(); $qb = $this->dbConn->getQueryBuilder(); @@ -1381,7 +1381,7 @@ public function testGetSharesNode() { 'permissions' => $qb->expr()->literal(0), 'parent' => $qb->expr()->literal($id), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $file = $this->createMock(File::class); $file->method('getId')->willReturn(42); @@ -1415,7 +1415,7 @@ public function testGetSharesReshare() { 'file_target' => $qb->expr()->literal('myTarget'), 'permissions' => $qb->expr()->literal(13), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id1 = $qb->getLastInsertId(); $qb = $this->dbConn->getQueryBuilder(); @@ -1430,7 +1430,7 @@ public function testGetSharesReshare() { 'file_target' => $qb->expr()->literal('userTarget'), 'permissions' => $qb->expr()->literal(0), ]); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $id2 = $qb->getLastInsertId(); $file = $this->createMock(File::class); @@ -1506,7 +1506,7 @@ public function testDeleteFromSelfGroupNoCustomShare() { $stmt = $qb->select('*') ->from('share') ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(2))) - ->execute(); + ->executeQuery(); $shares = $stmt->fetchAll(); $stmt->closeCursor(); @@ -1530,7 +1530,7 @@ public function testDeleteFromSelfGroupAlreadyCustomShare() { 'file_source' => $qb->expr()->literal(1), 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2) - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $id = $qb->getLastInsertId(); @@ -1546,7 +1546,7 @@ public function testDeleteFromSelfGroupAlreadyCustomShare() { 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2), 'parent' => $qb->expr()->literal($id), - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $user1 = $this->createMock(IUser::class); @@ -1578,7 +1578,7 @@ public function testDeleteFromSelfGroupAlreadyCustomShare() { $stmt = $qb->select('*') ->from('share') ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(2))) - ->execute(); + ->executeQuery(); $shares = $stmt->fetchAll(); $stmt->closeCursor(); @@ -1603,7 +1603,7 @@ public function testDeleteFromSelfGroupUserNotInGroup() { 'file_source' => $qb->expr()->literal(1), 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2) - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $id = $qb->getLastInsertId(); @@ -1649,7 +1649,7 @@ public function testDeleteFromSelfGroupDoesNotExist() { 'file_source' => $qb->expr()->literal(1), 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2) - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $id = $qb->getLastInsertId(); @@ -1687,7 +1687,7 @@ public function testDeleteFromSelfUser() { 'file_source' => $qb->expr()->literal(1), 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2) - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $id = $qb->getLastInsertId(); @@ -1740,7 +1740,7 @@ public function testDeleteFromSelfUserNotRecipient() { 'file_source' => $qb->expr()->literal(1), 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2) - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $id = $qb->getLastInsertId(); @@ -1783,7 +1783,7 @@ public function testDeleteFromSelfLink() { 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(2), 'token' => $qb->expr()->literal('token'), - ])->execute(); + ])->executeStatement(); $this->assertEquals(1, $stmt); $id = $qb->getLastInsertId(); @@ -1930,7 +1930,7 @@ public function testUpdateLinkRemovePassword() { $qb->update('share'); $qb->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); $qb->set('password', $qb->createNamedParameter('password')); - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); $users = []; for ($i = 0; $i < 6; $i++) { @@ -2271,7 +2271,7 @@ public function testDeleteUser($type, $owner, $initiator, $recipient, $deletedUs ->setValue('item_type', $qb->createNamedParameter('file')) ->setValue('item_source', $qb->createNamedParameter(42)) ->setValue('file_source', $qb->createNamedParameter(42)) - ->execute(); + ->executeStatement(); $id = $qb->getLastInsertId(); @@ -2482,7 +2482,7 @@ public function testUserDeletedFromGroup($group, $user, $toDelete) { ->setValue('item_type', $qb->createNamedParameter('file')) ->setValue('item_source', $qb->createNamedParameter(42)) ->setValue('file_source', $qb->createNamedParameter(42)); - $qb->execute(); + $qb->executeStatement(); $id1 = $qb->getLastInsertId(); $qb = $this->dbConn->getQueryBuilder(); @@ -2495,7 +2495,7 @@ public function testUserDeletedFromGroup($group, $user, $toDelete) { ->setValue('item_source', $qb->createNamedParameter(42)) ->setValue('file_source', $qb->createNamedParameter(42)) ->setValue('parent', $qb->createNamedParameter($id1)); - $qb->execute(); + $qb->executeStatement(); $id2 = $qb->getLastInsertId(); $this->provider->userDeletedFromGroup($user, $group); @@ -2814,7 +2814,7 @@ public function testGetAllShares() { 'file_target' => $qb->expr()->literal('myTarget1'), 'permissions' => $qb->expr()->literal(13), ]); - $qb->execute(); + $qb->executeStatement(); $id1 = $qb->getLastInsertId(); @@ -2829,7 +2829,7 @@ public function testGetAllShares() { 'file_target' => $qb->expr()->literal('myTarget2'), 'permissions' => $qb->expr()->literal(14), ]); - $qb->execute(); + $qb->executeStatement(); $id2 = $qb->getLastInsertId(); diff --git a/tests/lib/Share20/ShareByMailProviderTest.php b/tests/lib/Share20/ShareByMailProviderTest.php index 0cdd13fe17ce5..2c0ed246d0281 100644 --- a/tests/lib/Share20/ShareByMailProviderTest.php +++ b/tests/lib/Share20/ShareByMailProviderTest.php @@ -118,7 +118,7 @@ protected function setUp(): void { $this->config = $this->createMock(IConfig::class); // Empty share table - $this->dbConn->getQueryBuilder()->delete('share')->execute(); + $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); $this->provider = new ShareByMailProvider( $this->config, @@ -140,9 +140,9 @@ protected function setUp(): void { } protected function tearDown(): void { - $this->dbConn->getQueryBuilder()->delete('share')->execute(); - $this->dbConn->getQueryBuilder()->delete('filecache')->execute(); - $this->dbConn->getQueryBuilder()->delete('storages')->execute(); + $this->dbConn->getQueryBuilder()->delete('share')->executeStatement(); + $this->dbConn->getQueryBuilder()->delete('filecache')->executeStatement(); + $this->dbConn->getQueryBuilder()->delete('storages')->executeStatement(); } /** @@ -201,7 +201,7 @@ private function addShareToDB($shareType, $sharedWith, $sharedBy, $shareOwner, $qb->setValue('parent', $qb->expr()->literal($parent)); } - $this->assertEquals(1, $qb->execute()); + $this->assertEquals(1, $qb->executeStatement()); return $qb->getLastInsertId(); } diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index 647141a73f787..59f498870aca6 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -77,19 +77,19 @@ protected function setUp(): void { 'gid' => $qb->createNamedParameter($this->groups[0]->getGID()), 'uid' => $qb->createNamedParameter('orphanedUser') ]) - ->execute(); + ->executeStatement(); $qb->insert('group_admin') ->values([ 'gid' => $qb->createNamedParameter('orphanedGroup'), 'uid' => $qb->createNamedParameter('orphanedUser') ]) - ->execute(); + ->executeStatement(); $qb->insert('group_admin') ->values([ 'gid' => $qb->createNamedParameter('orphanedGroup'), 'uid' => $qb->createNamedParameter($this->users[0]->getUID()) ]) - ->execute(); + ->executeStatement(); } protected function tearDown(): void { @@ -105,7 +105,7 @@ protected function tearDown(): void { $qb->delete('group_admin') ->where($qb->expr()->eq('uid', $qb->createNamedParameter('orphanedUser'))) ->orWhere($qb->expr()->eq('gid', $qb->createNamedParameter('orphanedGroup'))) - ->execute(); + ->executeStatement(); } public function testCreateSubAdmin() { @@ -118,7 +118,7 @@ public function testCreateSubAdmin() { ->from('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($this->groups[0]->getGID()))) ->andWHere($qb->expr()->eq('uid', $qb->createNamedParameter($this->users[0]->getUID()))) - ->execute() + ->executeQuery() ->fetch(); $this->assertEquals( [ @@ -130,7 +130,7 @@ public function testCreateSubAdmin() { $result = $qb->delete('*PREFIX*group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($this->groups[0]->getGID()))) ->andWHere($qb->expr()->eq('uid', $qb->createNamedParameter($this->users[0]->getUID()))) - ->execute(); + ->executeQuery(); } public function testDeleteSubAdmin() { @@ -144,7 +144,7 @@ public function testDeleteSubAdmin() { ->from('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($this->groups[0]->getGID()))) ->andWHere($qb->expr()->eq('uid', $qb->createNamedParameter($this->users[0]->getUID()))) - ->execute() + ->executeQuery() ->fetch(); $this->assertEmpty($result); } diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index e4610ede9bf36..31581c9ebe1d1 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -70,8 +70,8 @@ protected function tearDown(): void { protected function pruneTagsTables() { $query = $this->connection->getQueryBuilder(); - $query->delete(SystemTagObjectMapper::RELATION_TABLE)->execute(); - $query->delete(SystemTagManager::TAG_TABLE)->execute(); + $query->delete(SystemTagObjectMapper::RELATION_TABLE)->executeStatement(); + $query->delete(SystemTagManager::TAG_TABLE)->executeStatement(); } public function getAllTagsDataProvider() { diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index 2c838e0a6b364..2de6b808f6fea 100644 --- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php @@ -111,8 +111,8 @@ protected function tearDown(): void { protected function pruneTagsTables() { $query = $this->connection->getQueryBuilder(); - $query->delete(SystemTagObjectMapper::RELATION_TABLE)->execute(); - $query->delete(SystemTagManager::TAG_TABLE)->execute(); + $query->delete(SystemTagObjectMapper::RELATION_TABLE)->executeStatement(); + $query->delete(SystemTagManager::TAG_TABLE)->executeStatement(); } public function testGetTagIdsForObjects() { diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index f5fc9a6e8f2c4..5b626e6ff622c 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -313,7 +313,7 @@ public static function tearDownAfterClass(): void { */ protected static function tearDownAfterClassCleanShares(IQueryBuilder $queryBuilder) { $queryBuilder->delete('share') - ->execute(); + ->executeStatement(); } /** @@ -323,7 +323,7 @@ protected static function tearDownAfterClassCleanShares(IQueryBuilder $queryBuil */ protected static function tearDownAfterClassCleanStorages(IQueryBuilder $queryBuilder) { $queryBuilder->delete('storages') - ->execute(); + ->executeStatement(); } /** @@ -333,7 +333,7 @@ protected static function tearDownAfterClassCleanStorages(IQueryBuilder $queryBu */ protected static function tearDownAfterClassCleanFileCache(IQueryBuilder $queryBuilder) { $queryBuilder->delete('filecache') - ->execute(); + ->executeStatement(); } /**