Skip to content

Commit 1eff9e5

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 65f52c4 commit 1eff9e5

File tree

3 files changed

+0
-59
lines changed

3 files changed

+0
-59
lines changed

lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace OC\DB\QueryBuilder;
1010

11-
use OC\DB\Exceptions\DbalException;
1211
use OCP\DB\IResult;
1312
use OCP\DB\QueryBuilder\IQueryBuilder;
1413
use OCP\IDBConnection;
@@ -47,21 +46,6 @@ public function getState() {
4746
return $this->builder->getState();
4847
}
4948

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-
6549
public function getSQL() {
6650
return $this->builder->getSQL();
6751
}

lib/private/DB/QueryBuilder/QueryBuilder.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Doctrine\DBAL\Query\QueryException;
1111
use OC\DB\ConnectionAdapter;
12-
use OC\DB\Exceptions\DbalException;
1312
use OC\DB\QueryBuilder\ExpressionBuilder\MySqlExpressionBuilder;
1413
use OC\DB\QueryBuilder\ExpressionBuilder\OCIExpressionBuilder;
1514
use OC\DB\QueryBuilder\ExpressionBuilder\PgSqlExpressionBuilder;
@@ -254,30 +253,6 @@ private function prepareForExecute() {
254253
}
255254
}
256255

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-
281256
public function executeQuery(?IDBConnection $connection = null): IResult {
282257
if ($this->getType() !== \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
283258
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)