在不用事务的情况下,如何保证插入数据库时不失败,三张表。

WBOY
Release: 2016-06-06 20:21:46
Original
1235 people have browsed it

三张表要么全成功,要么全失败。

回复内容:

三张表要么全成功,要么全失败。

那你就把插入完后的状态记录下来, 如果发现有某一条插入失败的话,再去手动删除另外两条。

不可能啊~ 这就是事务发挥作用的场景,确保all or nothing

事务的设计就是用来解决这个问题的,为何偏要不用呢,无法理解

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!