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
fix(transaction): delete autocommit when transaction begin (#9877) #9921
fix(transaction): delete autocommit when transaction begin (#9877) #9921
Conversation
186b095
to
0115b34
Compare
MySQL transaction with AUTO COMMIT = 1 does defeat purpose of having transaction i.e. each statement is committed as soon as it is finished without any chance of rollback. This is also default behaviour of MySQL. Two things can be done here
|
Since we are executing START TRANSACTION internally, is not it possible to do SET autocommit = 0 to affect the behavior until the end of the transaction? If we explicitly use a transaction, it seems that it was behavior that autocommit had no effect until you explicitly commit or roll back. Sorry if my understanding was wrong. |
Hmm you are right, https://dev.mysql.com/doc/refman/8.0/en/commit.html
So If I understood correctly SET AUTOCOMMIT = 0;
#DO STUFF
COMMIT; None of other database engine use |
0115b34
to
e22c46b
Compare
@sushantdhiman In addition to MySQL, PostgreSQL, SQLite, and MS SQL Server seem to have autocommit statement. However, the essential meaning of the autocommut statement is that any product is similar, I also deleted options and query generation methods. Thank you for your review. |
Yeah I meant more at Sequelize level, where we only support/implemented this for MySQL. |
Thanks @tsasaki609 |
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
fix #9877
Statements within a transaction should either be all successful, or all fail. Autocommit arguments that initiate transactions are misleading and should not be provided. If we want to enable autocommit, we should explicitly call auto-commit. How do you think?