public function commit()
{
if ($this->_transactionNestingLevel == 0) {
throw ConnectionException::noActiveTransaction();
}
if ($this->_isRollbackOnly) {
throw ConnectionException::commitFailedRollbackOnly();
}
if ($this->_transactionNestingLevel == 1) {
$this->_conn->commit();
} else if ($this->_nestTransactionsWithSavepoints) {
$this->releaseSavepoint($this->_getNestedTransactionSavePointName());
}
--$this->_transactionNestingLevel;
}
三、laravel的解决方案
laravel的处理方式相对简单粗暴一些,我们先来看下创建事务的操作:
复制代码 代码如下:
public function beginTransaction()
{
++$this->transactions;