Skip to content

Implement mysqli_execute_query() #8660

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

Merged
merged 2 commits into from
Jul 6, 2022

Conversation

kamil-tekiela
Copy link
Member

This is the implementation for RFC https://wiki.php.net/rfc/mysqli_execute_query

Key notes:

  • While the code was copied from prepare, execute, and get_result, there were some adjustments and it's not identical.
  • It returns true on success when no result is present. It resembles more mysqli_query than get_result.
  • The authors of the RFC decided that it was a bug that affected_rows was reset to -1. The value is now preserved in the $mysql object.
  • Regarding performance: a quick artificial benchmark showed 6% decrease in execution time when compared to calling all 3 methods separately.
  • As the mysqli_stmt object is never exposed, special attention was put to error handling and ensuring the memory is freed when necessary. The error messages are preserved on the $mysql object for when automatic error reporting is switched off.

@adoy adoy added this to the PHP 8.2 milestone May 31, 2022
@kamil-tekiela kamil-tekiela force-pushed the execute_query branch 2 times, most recently from 53795e2 to d323ec2 Compare June 11, 2022 21:16
Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This looks good to me.

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

Successfully merging this pull request may close these issues.

4 participants