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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:21:46
Original
1306 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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template