The Wayback Machine - https://web.archive.org/web/20210128101822/https://github.com/php/php-src/pull/6497
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

PDO MySQL: Normalize handling of empty stored procedure result set #6497

Closed
wants to merge 1 commit into from

Conversation

@nikic
Copy link
Member

@nikic nikic commented Dec 8, 2020

MySQL always returns a trailing empty result set for stored procedure calls, which is used to convey status information. The PDO MySQL implementation is presently confused about what to do with it: If mysqlnd is used and native prepared statements are used, this result set is skipped. In all other cases it is not skipped. We also have quite a few XFAILed tests relating to this.

This PR normalizes (for PHP-8.0 only) the behavior towards always retaining the empty result set. This is simply how MySQL stored procedures work (some expletives omitted here) and we can't distinguish this "useless" result set from an empty result of a multi query. Multi queries are not a concern for native prepared statements, as PDO does not allow them in that case, but they are a concern for emulated prepared statements.

@nikic
Copy link
Member Author

@nikic nikic commented Dec 8, 2020

@kamil-tekiela @cmb69 I believe this matches the conclusion we have arrived at, right?

@nikic
Copy link
Member Author

@nikic nikic commented Dec 8, 2020

Worth noting that since a83cc03 it's possible to fetch the final result set, while previously that might have resulted in an exception.

@cmb69
Copy link
Contributor

@cmb69 cmb69 commented Dec 8, 2020

Yes, it's probably best to leave that to userland.

@kamil-tekiela
Copy link
Contributor

@kamil-tekiela kamil-tekiela commented Dec 8, 2020

That is correct. I actually started working on it couple of days ago, but my free time is limited. The empty result set is expected from stored procedure and we should have the same behaviour for emulated and native. As long as all the test cases pass I agree with those changes.

The $expected array in the oracle nulls test case is probably not needed anymore

@php-pulls php-pulls closed this in 2df09b9 Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants