src/Leevel/Database/Connect.php
public function commit(): void
    {
        if (0 === $this->transactionLevel) {
            throw new InvalidArgumentException('There was no active transaction.');
        }

        if ($this->isRollbackOnly) {
            throw new InvalidArgumentException('Commit failed for rollback only.');
        }

        if (1 === $this->transactionLevel) {
            $this->pdo(true)->commit();
        } elseif ($this->transactionLevel > 1 && $this->hasSavepoints()) {
            $this->releaseSavepoint($this->getSavepointName());
        }

        $this->transactionLevel = max(0, $this->transactionLevel - 1);
    }
public function commit(): void
    {
        if (0 === $this->transactionLevel) {
            throw new InvalidArgumentException('There was no active transaction.');
        }

        if ($this->isRollbackOnly) {
            throw new InvalidArgumentException('Commit failed for rollback only.');
        }

        if (1 === $this->transactionLevel) {
            $this->pdo(true)->commit();
        } elseif ($this->transactionLevel > 1 && $this->hasSavepoints()) {
            $this->releaseSavepoint($this->getSavepointName());
        }

        $this->transactionLevel = max(0, $this->transactionLevel - 1);
    }
用于非自动提交状态下面的查询提交.