MYSQL回滚,当发生外键约束等错误时,会自动回滚吗?

WBOY
Release: 2016-06-23 13:32:34
Original
1528 people have browsed it

MYSQL回滚,当发生外键约束等错误时,会自动回滚吗?
是否需要自己手动判断外键,然后手动rollback?


回复讨论(解决方案)

什么叫 自动回滚? 回滚 到哪里?
既然发生错误,正在执行的指令就什么都没做,所以也不存在回滚

当存在外键约束时也一样,并不存在主表成功子表失败或自表成功主表失败的情况,MySQL 会自行验证,只在都成功的情况下才会完成操作

所谓事务回滚并非 MySQL 的功能,而是用户的一种需求。mysql 只是提供一个容器,来帮助用户实现

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template