Mysql advanced transactions
Generally speaking, a transaction refers to a group of operations, either successfully executed or not executed. ----> atomicity
Before all operations are completed, other sessions cannot see the process of intermediate changes-> isolation
Before and after a transaction occurs, the total amount of data still matches -----> consistency
Transaction impact cannot be undone ------> persistence
If an error occurs, the transaction cannot be undone and can only be undone through "compensatory transactions"
Transfer
Li San: ---> spending 500, Li San-500
Zhao 4: ----> received 500, Zhao 4 + 500
About the transaction engine:
Select innodb/bdb
Start transaction: start transaction;
SQL ....
SQL ....
Submit
Rollback
Note: when a transaction commit or rollback ends
Note: Some statements may cause implicit transaction commit, such as start transaction.
A specific example of a transaction: