From 279151825ae7c00d77c4e8ee1d76c4b9f96f0ad1 Mon Sep 17 00:00:00 2001 From: whwyy Date: Sun, 11 Jan 2026 19:29:35 +0800 Subject: [PATCH] eee --- Command.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Command.php b/Command.php index 1f7ba86..b787480 100644 --- a/Command.php +++ b/Command.php @@ -229,7 +229,33 @@ class Command extends Component */ public function delete(): bool { - return (bool)$this->_prepare(); + $client = $this->connection->getConnection(); + try { + $startTime = microtime(true); + if (($prepare = $client->prepare($this->sql)) === false) { + throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $prepare->errorInfo()[2]); + } + if ($prepare->execute($this->params) === false) { + throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $prepare->errorInfo()[2]); + } + $prepare->closeCursor(); + + $this->connection->println($startTime, microtime(true), $this->sql, $this->params); + + return true; + } catch (Throwable $throwable) { + $this->getLogger()->json_log($throwable); + + if ($this->isRefresh($throwable)) { + return $this->_prepare(); + } + + $errorMsg = $throwable->getMessage() . PHP_EOL . ' Sql: ' . $this->sql . '.' . json_encode($this->params, JSON_UNESCAPED_UNICODE); + + return $this->getLogger()->logCategory($errorMsg . PHP_EOL, 'mysql'); + } finally { + $this->connection->release($client); + } }