1) See which engines support transactions:
SQL: Show engines;
2) View the table engine type:
Show create table table_name;
3) Check if it is automatically submitted:
show variables like ‘%autocommit%’;
4) The method of transaction start:
a) mysql_autocommit(0); If the program is coredump here, please check if connect db
b) SQL:Set autocommit=0;
c) Begin work;
d) Start transaction;
5) The method of the end of the transaction:
a) SQL:Commit/rollback
b) Mysql_commit/mysqlrollback
c) Implicit transaction, refer to http://blog.csdn.net/blues1021/article/details/6329190
Concurrent transactions:
Lock Mechanism:
Optimistic locking: controlled by the where condition, controlled by the value of the version field or custom field;
The number of rows affected by update : the return value of mysql_affected_rows , which can be used to determine whether the transaction is terminated
Pessimistic lock = exclusive lock
Select * from table for update;