transaction control

hi, i was using: { set autocommit off start transaction lock tables insert records unlock tables rollback } expecting: inserted records are rolled back; experiencing: inserted records are commited;

if i change unlock tables after rollback, the transactions are rolled back.

question: does <unlock tables> an implicit commit like DDL?

did i miss something in the description of transaction control?

Answer Answered by Daniel Black in this comment.

Yes, `unlock tables` does an implicit commit too. Locking tables shouldn't be part of transactions, the control provided by start transaction and other partial row level locks like `select in share mode`, `select ... for update` should be sufficient.

LOCK TABLES is there for large system wide schema/backups but even then, if you are using them, your probably not following best practices in database schema changes or/backups.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.