You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To differentiate between select and manipulation queries, the Statement should differentiate using two methods executeQuery() which returns a Result and executeStatement which returns the number of affected rows.
This was tackled in #4580 as a way to ensure forwards compatibility with the 3.x branch, but it also improves the API in the process.
In turn Statement::execute is also deprecated and gets removed in DBAL 4.0. You must replace the following code:
// old code$sql = 'SELECT * FROM user';
$result = $connection->prepare($sql)->execute();
// new code$sql = 'SELECT * FROM user';
$result = $connection->prepare($sql)->executeQuery();
and for manipulation or DDL statements:
// old code$sql = 'UPDATE user SET disabled = 1';
$result = $connection->prepare($sql)->execute();
// new code$sql = 'UPDATE user SET disabled = 1';
$result = $connection->prepare($sql)->executeStatement();
The text was updated successfully, but these errors were encountered:
Because executeUpdate wasn't a great name. And in DBAL they also use
executeStatement more consistently now.
Ref doctrine/dbal#4607
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Feature Request
Summary
To differentiate between select and manipulation queries, the
Statement
should differentiate using two methodsexecuteQuery()
which returns aResult
andexecuteStatement
which returns the number of affected rows.This was tackled in #4580 as a way to ensure forwards compatibility with the 3.x branch, but it also improves the API in the process.
In turn
Statement::execute
is also deprecated and gets removed in DBAL 4.0. You must replace the following code:and for manipulation or DDL statements:
The text was updated successfully, but these errors were encountered: