From fd71d23802197445fc7df8984753a3f8ea3e8e50 Mon Sep 17 00:00:00 2001 From: whwyy Date: Tue, 12 Dec 2023 17:40:51 +0800 Subject: [PATCH] eee --- Connection.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Connection.php b/Connection.php index 9108282..1db0a53 100644 --- a/Connection.php +++ b/Connection.php @@ -193,11 +193,8 @@ class Connection extends Component */ public function beginTransaction(): static { - if ($this->storey == 0) { - $pdo = $this->getTransactionClient(); - if (!$pdo->inTransaction()) { - $pdo->beginTransaction(); - } + if ($this->storey < 0 ) { + $this->storey = 0; } $this->storey++; return $this; @@ -214,9 +211,9 @@ class Connection extends Component if ($pdo === null) { /** @var PDO $pdo */ $pdo = Context::set($this->cds, $this->getNormalClientHealth()); - if ($this->storey > 0 && !$pdo->inTransaction()) { - $pdo->beginTransaction(); - } + } + if ($this->storey > 0 && !$pdo->inTransaction()) { + $pdo->beginTransaction(); } return $pdo; }