From 7e7d63969be21ef6dbb69bfbd674ac1c3b3da4a6 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 2 May 2021 14:33:05 +0800 Subject: [PATCH] modify --- Database/Command.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Database/Command.php b/Database/Command.php index 104a27f9..6af8a7be 100644 --- a/Database/Command.php +++ b/Database/Command.php @@ -121,14 +121,14 @@ class Command extends Component private function execute($type, $isInsert = null, $hasAutoIncrement = null): int|bool|array|string|null { try { + if ($this->prepare) { + $this->prepare->closeCursor(); + } if ($type === static::EXECUTE) { $result = $this->insert_or_change($isInsert, $hasAutoIncrement); } else { $result = $this->search($type); } - if ($this->prepare) { - $this->prepare->closeCursor(); - } return $result; } catch (\Throwable $exception) { return $this->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql');