From 735c077f46e56e297e5c071eb20b8881ff0aebef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 2 Apr 2023 20:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Connection.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Connection.php b/Connection.php index 0c3837e..7c49696 100644 --- a/Connection.php +++ b/Connection.php @@ -186,7 +186,14 @@ class Connection extends Component */ public function getPdo(): PDO { - return $this->getMasterClient(); + if (!Db::inTransactionsActive()) { + return $this->getMasterClient(); + } + if (!Context::hasContext($this->cds)) { + return Context::setContext($this->cds, $this->getMasterClient()); + } else { + return Context::getContext($this->cds); + } } /**