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
The PDO driver throws the following exception when trying to close a prepared statement cursor with PDOStatement::closeCursor() if the statement has not been executed yet.
The statement must be executed before results can be retrieved.
While this is not completely wrong, the behaviour does not adhere to the PDO interface. The contract clearly states that in case of an error false is to be returned. Exceptions not allowed.
This is especially important when trying to build database abstractions where consistent behaviour across different PDO implementation is desired. We currently have discovered that issue in our testsuite (Doctrine DBAL). While all PDO implementations we support return false, pdo_sqlsrv throws an exception.
$connection = new \PDO(/* connection parameters */);
$statement = $connection->prepare('SELECT foo FROM bar');
$statement->closeCursor();
Any chance we can change the driver's behaviour here?
The text was updated successfully, but these errors were encountered:
The PDO driver throws the following exception when trying to close a prepared statement cursor with
PDOStatement::closeCursor()
if the statement has not been executed yet.While this is not completely wrong, the behaviour does not adhere to the PDO interface. The contract clearly states that in case of an error
false
is to be returned. Exceptions not allowed.This is especially important when trying to build database abstractions where consistent behaviour across different PDO implementation is desired. We currently have discovered that issue in our testsuite (Doctrine DBAL). While all PDO implementations we support return
false
,pdo_sqlsrv
throws an exception.Any chance we can change the driver's behaviour here?
The text was updated successfully, but these errors were encountered: