refactor: Clean up mysqli transactions #9888
Open
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.
Description
Turning off autocommit and starting a transaction makes very little sense. Unless you expect users to issue manual commit statements, the begin transaction is sufficient. Comparing it to the other Connection classes, only the mysqli one does that, which can be considered a bug. If you would like to allow the user to issue manual commit statements then keep only autocommit and remove begin and commit. Additionally, these functions always return true (because of exception mode) and so the if statements and return statements are not meaningful.
Checklist: