From 6cb5899fe191f9c2403dd89c0b818e8d72bc8383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 24 Aug 2023 14:13:22 +0800 Subject: [PATCH] qqq --- Connection.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Connection.php b/Connection.php index b9749d0..e5b12c0 100644 --- a/Connection.php +++ b/Connection.php @@ -202,7 +202,7 @@ class Connection extends Component if ($this->storey == 0) { /** @var PDO $pdo */ $pdo = Context::get($this->cds); - if ($pdo instanceof PDO && !$pdo->inTransaction()) { + if ($pdo instanceof PDO && !$this->inTransaction()) { $pdo->beginTransaction(); } } @@ -220,7 +220,7 @@ class Connection extends Component $pdo = Context::get($this->cds); if ($pdo === null) { $pdo = $this->getNormalClientHealth(); - if ($this->storey > 0 && !$pdo->inTransaction()) { + if ($this->storey > 0 && !$this->inTransaction()) { $pdo->beginTransaction(); } Context::set($this->cds, $pdo); @@ -263,7 +263,7 @@ class Connection extends Component if ($pdo === null) { return; } - if ($pdo->inTransaction()) { + if ($this->inTransaction()) { $pdo->commit(); } $this->pool()->push($this->cds, [$pdo, time()]); @@ -283,7 +283,7 @@ class Connection extends Component if ($pdo === null) { return; } - if ($pdo->inTransaction()) { + if ($this->inTransaction()) { $pdo->rollback(); } $this->pool()->push($this->cds, [$pdo, time()]); @@ -310,8 +310,8 @@ class Connection extends Component */ public function release(PDO $PDO): void { - file_put_contents('php://output', '回收PDO连接. inTransaction ' . (int)$PDO->inTransaction() . $this->cds, FILE_APPEND); - if ($PDO->inTransaction()) { + file_put_contents('php://output', '回收PDO连接. inTransaction ' . (int)$this->inTransaction() . $this->cds, FILE_APPEND); + if ($this->inTransaction()) { return; } file_put_contents('php://output', '回收PDO连接.' . $this->cds, FILE_APPEND);