From 12d3d05001966838f1cec12dd1dcd578c9f9d42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 7 Apr 2023 21:10:44 +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 --- Command.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Command.php b/Command.php index 2f64cc4..2ff10d3 100644 --- a/Command.php +++ b/Command.php @@ -97,7 +97,7 @@ class Command extends Component throw new Exception($client->errorInfo()[1]); } foreach ($this->params as $key => $param) { - $prepare->bindParam($key, $param); + $prepare->bindParam($key, $param, PDO::PARAM_STR | PDO::PARAM_INT); } return $prepare->fetch(PDO::FETCH_ASSOC); } catch (\Throwable $throwable) { @@ -122,7 +122,7 @@ class Command extends Component throw new Exception($client->errorInfo()[1]); } foreach ($this->params as $key => $param) { - $prepare->bindParam($key, $param); + $prepare->bindParam($key, $param, PDO::PARAM_STR | PDO::PARAM_INT); } return $prepare->fetchColumn(PDO::FETCH_ASSOC); } catch (\Throwable $throwable) { @@ -147,7 +147,7 @@ class Command extends Component throw new Exception($client->errorInfo()[1]); } foreach ($this->params as $key => $param) { - $prepare->bindParam($key, $param); + $prepare->bindParam($key, $param, PDO::PARAM_STR | PDO::PARAM_INT); } return $prepare->rowCount(); } catch (\Throwable $throwable) { @@ -207,7 +207,7 @@ class Command extends Component */ private function error(\Throwable $throwable): bool { - $message = $this->sql . '(' . json_encode($this->params, JSON_UNESCAPED_UNICODE) . ');'; + $message = $this->sql . '.' . json_encode($this->params, JSON_UNESCAPED_UNICODE); return $this->logger->addError($message . $throwable->getMessage(), 'mysql'); }