This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Fix: execute() should return rows affected by operation if lastrowid is not set.#150
Merged
gvbgduh merged 2 commits intoencode:masterfrom Mar 16, 2020
gnat:execute-return-rows-affected-mysql-sqlite
Merged
Fix: execute() should return rows affected by operation if lastrowid is not set.#150gvbgduh merged 2 commits intoencode:masterfrom gnat:execute-return-rows-affected-mysql-sqlite
gvbgduh merged 2 commits intoencode:masterfrom
gnat:execute-return-rows-affected-mysql-sqlite
Conversation
Contributor
Author
|
@tomchristie Possible to get this merged? |
Contributor
|
Oh, nice! That makes sense. That would also apply for the upcoming for insert for update: for delete: As a plain string, so simple parsing should. Would be very nice to add it to this PR as well, but I can push it a bit later with a different issue to not forget to update |
Contributor
Author
|
@gvbgduh That sounds like a great plan. In the mean time, is there anything holding up getting this merged? |
Contributor
|
@gnat sorry for a delay, merging it now |
Contributor
Author
|
Amazing, thank you @gvbgduh ! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Patch closes the following issues:
Old behavior: Calls to execute() return lastrowid. For some operations this has no benefit.
New behavior: Calls to execute() where lastrowid has no benefit will now return rows affected by the operation. (Example: DELETE. So we can now see if a DELETE was successful, and how many rows were deleted). Calls which set a lastrowid value, will still retain the old behavior.
The library encode/databases depends on, aiomysql, returns rows affected, the desired behaviour this patch implements. See: https://github.com/aio-libs/aiomysql/blob/master/aiomysql/cursors.py#L244