Laravel 嵌套事务 transactions

Posted willem_chen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Laravel 嵌套事务 transactions相关的知识,希望对你有一定的参考价值。

前言

关于 mysql 的事务嵌套可以查看这个地址:
https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html

里面有这么一句话

Transactions cannot be nested. This is a consequence of the implicit commit performed for any current transaction when you issue a START TRANSACTION statement or one of its synonyms.

大体意思是 db 不支持事务嵌套,如果你嵌套执行 START TRANSACTION 时会隐式执行 commit

我们做个测试:

mysql>  BEGIN;
Query OK

以上是关于Laravel 嵌套事务 transactions的主要内容,如果未能解决你的问题,请参考以下文章