Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2020年3月25号 你要记录点什么? #54

Open
weblixin opened this issue Mar 25, 2020 · 0 comments
Open

2020年3月25号 你要记录点什么? #54

weblixin opened this issue Mar 25, 2020 · 0 comments

Comments

@weblixin
Copy link
Collaborator

事务控制语句

  • BEGIN/START TRANSACTION 显示的开启一个事物
  • COMMITCOMMIT WORK 提交事务,并且使已对数据库进行的修改编程永久性的
  • ROLLBACKROLLBACK WORK 回滚事务,并且撤销正在进行的所有未提交的修改
  • SAVEPOINT identifierSAVEPOINT 允许在事务中创建一个保存点,一个事务可以有多个保存点
  • RELEASE SAVEPOINT identifier 删除一个事务的保存点,当没有保存点是,会抛出异常
  • ROOLBACK TO identifier 把事务回滚到保存点
  • SET TRANSACTION 用老设置事务的隔离级别

MySQL 事务处理的方法

  1. BEGINROLLBACKCOMMIT 实现
    • BEGIN 开始一个事务
    • ROLLBACK 事务回滚
    • COMMIT 事务确认/提交
  2. SET 改变 MySQL 的自动提交模式
    • SET AUTOCOMMIT=0 禁止自动提交
    • SET AUTOCOMMIT=1 开启自动提交
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant