三十一、事务的例子
MyIASM表如何进行事务处理:
mysql LOCK TABLES trans READ, customer WRITE;
mysql select sum(value) from trans where customer_id=some_id;
mysql update customer set total_value=sum_from_previous_statement
where customer_id=some_id;
mysql UNLOCK TABLES;
BDB表如何进行事务:
mysql BEGIN WORK;
mysql select sum(value) from trans where customer_id=some_id;
mysql update customer set total_value=sum_from_previous_statement
where customer_id=some_id;
mysql COMMIT;<...[ 查看全文 ]