昨天去银行转钱,最后怒失300万原创
2年前
581076
我的300万"不见"了
-
检查小 埃账户里面余额至少有300万。 -
从小 埃账户余额中 扣 减300万。 -
给小克账户余额 增加300万。
手动开启一个MySQL事务
mysql> set autocommit = 0;Query OK, 0 rows affected (0.00 sec)mysql> show variables like 'autocommit';+---------------+-------+| Variable_name | Value |+---------------+-------+| autocommit | OFF |+---------------+-------+1 row in set (0.01 sec)update bank_balance set balance = balance - 300000000 where user_name = '小埃';Query OK, 1 row affected (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> commit;Query OK, 0 rows affected (0.00 sec)
事务的特征都有哪些?
begin;update table set user_name = '小埃' where user_name = '小克';insert into table(user_name)values('小埃');
commit;
丢失的300万"回来"了
事务开始
-
检查小埃账户里面余额至少有300万。 -
从小埃账户余额中扣减300万。 -
给小克账户余额增加300万。 提交事务
点赞收藏
分类:
