Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] PDO driver should not throw exception on "closeCursor()" #267

Closed
deeky666 opened this issue Feb 1, 2017 · 1 comment
Closed

Comments

@deeky666
Copy link

deeky666 commented Feb 1, 2017

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?

@ulvii
Copy link
Contributor

ulvii commented Apr 17, 2017

Hi @deeky666 ,

Could you confirm if this issue has been resolved with the latest release? https://github.com/Microsoft/msphpsql/releases/tag/v4.1.8-preview
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants