MySQL autorise-t-il l'utilisation de transactions imbriquées?
mysql
transactions
nested-transactions
Alix Axel
la source
la source
Réponses:
InnoDB
prend en chargeSAVEPOINTS
.Vous pouvez faire ce qui suit:
CREATE TABLE t_test (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; START TRANSACTION; INSERT INTO t_test VALUES (1); SELECT * FROM t_test; id --- 1 SAVEPOINT tran2; INSERT INTO t_test VALUES (2); SELECT * FROM t_test; id --- 1 2 ROLLBACK TO tran2; SELECT * FROM t_test; id --- 1 ROLLBACK; SELECT * FROM t_test; id ---
la source
Depuis la documentation MySQL:
la source