From d9fd802312f9e4dd09234ba46b62a484886a9eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 2 Apr 2023 23:28:23 +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 | 2 +- Connection.php | 2 +- Mysql/PDO.php | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Command.php b/Command.php index 3644b43..3a19da5 100644 --- a/Command.php +++ b/Command.php @@ -208,7 +208,7 @@ class Command extends Component } /** - * @return array|bool + * @return array|bool * @throws Exception */ private function search(): bool|array diff --git a/Connection.php b/Connection.php index 8e6eac4..24a80e0 100644 --- a/Connection.php +++ b/Connection.php @@ -160,7 +160,7 @@ class Connection extends Component } /** - * @return PDO + * @return Mysql\PDO * @throws Exception */ public function getSlaveClient(): Mysql\PDO diff --git a/Mysql/PDO.php b/Mysql/PDO.php index a2ef906..6b6d727 100644 --- a/Mysql/PDO.php +++ b/Mysql/PDO.php @@ -13,7 +13,7 @@ use Kiri\Server\Abstracts\StatusEnum; use Swoole\Timer; /** - * + * @mixin \PDO */ class PDO implements StopHeartbeatCheck { @@ -89,6 +89,27 @@ class PDO implements StopHeartbeatCheck } + /** + * @param string $name + * @param array $arguments + * @return mixed + */ + public function __call(string $name, array $arguments) + { + return $this->_pdo()->{$name}(...$arguments); + } + + + /** + * @param string $sql + * @return PDOStatement|bool + */ + public function prepare(string $sql): PDOStatement|bool + { + return $this->_pdo()->prepare($sql); + } + + /** * */