Various fixes for mariadb_use_result#174
Closed
rovo89 wants to merge 4 commits intoperl5-dbi:masterfrom
Closed
Conversation
mysql_num_rows() is 0 after mysql_use_result() until all results have been fetched, so we can't rely on it to decide if there will be more rows.
It isn't supported and an error is thrown when mariadb_server_prepare_disable_fallback is set. With the fallback enabled though there's an infinite loop because mariadb_st_fetch() doesn't know that the fallback was used and goes into the wrong branch.
mysql_use_result() requires fetching all rows before executing the next query, otherwise we'd get an error 2014 (Commands out of sync). This can be relevant if the script leaves the result loop early. If it explicitly calls $sth->finish() that would croak, if it undefines $sth it would get a warning. If it doesn't do anything and executes another query, it croaks. With this fix, the pending rows are fetched silently. For multi-result sets we could use mysql_store_result() for the remaining results, that would consume more memory to buffer all rows, rather than just fetching and discarding each individual row.
Member
|
@rovo89 Is there still something related to mariadb_use_result attribute which needs to be fixed? |
Author
|
The stuff in #175 is kind of related, but in a different context. I'll close this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.