Skip to content

Commit 275b857

Browse files
committed
feat(querybuilder): Remove deprecated IQueryBuilder::execute
This won't work when we update to doctrine DBAL 4 and all usages in server were ported away. Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
1 parent 28eb887 commit 275b857

File tree

3 files changed

+0
-57
lines changed

3 files changed

+0
-57
lines changed

lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,6 @@ public function getState() {
4747
return $this->builder->getState();
4848
}
4949

50-
public function execute(?IDBConnection $connection = null) {
51-
try {
52-
if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
53-
return $this->executeQuery($connection);
54-
} else {
55-
return $this->executeStatement($connection);
56-
}
57-
} catch (DBALException $e) {
58-
// `IQueryBuilder->execute` never wrapped the exception, but `executeQuery` and `executeStatement` do
59-
/** @var \Doctrine\DBAL\Exception $previous */
60-
$previous = $e->getPrevious();
61-
throw $previous;
62-
}
63-
}
64-
6550
public function getSQL() {
6651
return $this->builder->getSQL();
6752
}

lib/private/DB/QueryBuilder/QueryBuilder.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -254,30 +254,6 @@ private function prepareForExecute() {
254254
}
255255
}
256256

257-
/**
258-
* Executes this query using the bound parameters and their types.
259-
*
260-
* Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
261-
* for insert, update and delete statements.
262-
*
263-
* @return IResult|int
264-
*/
265-
public function execute(?IDBConnection $connection = null) {
266-
try {
267-
if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
268-
return $this->executeQuery($connection);
269-
} else {
270-
return $this->executeStatement($connection);
271-
}
272-
} catch (DBALException $e) {
273-
// `IQueryBuilder->execute` never wrapped the exception, but `executeQuery` and `executeStatement` do
274-
/** @var \Doctrine\DBAL\Exception $previous */
275-
$previous = $e->getPrevious();
276-
277-
throw $previous;
278-
}
279-
}
280-
281257
public function executeQuery(?IDBConnection $connection = null): IResult {
282258
if ($this->getType() !== \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
283259
throw new \RuntimeException('Invalid query type, expected SELECT query');

lib/public/DB/QueryBuilder/IQueryBuilder.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,24 +190,6 @@ public function getConnection();
190190
*/
191191
public function getState();
192192

193-
/**
194-
* Executes this query using the bound parameters and their types.
195-
*
196-
* Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeStatement}
197-
* for insert, update and delete statements.
198-
*
199-
* Warning: until Nextcloud 20, this method could return a \Doctrine\DBAL\Driver\Statement but since
200-
* that interface changed in a breaking way the adapter \OCP\DB\QueryBuilder\IStatement is returned
201-
* to bridge old code to the new API
202-
*
203-
* @param ?IDBConnection $connection (optional) the connection to run the query against. since 30.0
204-
* @return IResult|int
205-
* @throws Exception since 21.0.0
206-
* @since 8.2.0
207-
* @deprecated 22.0.0 Use executeQuery or executeStatement
208-
*/
209-
public function execute(?IDBConnection $connection = null);
210-
211193
/**
212194
* Execute for select statements
213195
*

0 commit comments

Comments
 (0)