@author: Tobin
@date: 2019/11/7 17:27:01
Transaction processing is used to maintain the integrity of the database to ensure that the bulk of MySQL operation either not executed or are executed.
InnoDB support transactions.
ROOLBACK: fallback. You can not roll back CREATE and DROP
SELECT * FROM ordertotals;
START TRANSACTION;
DELETE FROM ordertotals;
SELECT * FROM ordertotals;
ROOLBACK;
SELECT * FROM ordertotals;
COMMIT: write-back analogy, if the statement is executed, some unsuccessful, will not be executed
START TRANSACTION;
DELETE FROM order_items WHERE order_num = 20010;
DELETE FROM orders WHERE order_num = 20010;
COMMIT;
SAVEPOINT: retention point, some fallback
SAVEPOINT delete1;
ROOLBACK TO delete1;
The default MySQL statement is automatically submit all changes.
Do not use the default submit the following statement.
SET autocommit = 0;