diff --git a/Command.php b/Command.php index d4d7ed6..095c991 100644 --- a/Command.php +++ b/Command.php @@ -14,7 +14,6 @@ use Exception; use Kiri\Abstracts\Component; use Kiri\Di\Container; use PDO; -use PDOStatement; use Throwable; /** @@ -28,7 +27,6 @@ class Command extends Component public ?string $sql = ''; public array $params = []; - /** * @param array $params * @throws @@ -123,13 +121,10 @@ class Command extends Component throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $client->errorInfo()[2]); } - $prepare->execute($this->params); + $result = $method == 'rowCount' ? $prepare->rowCount() : $prepare->{$method}(PDO::FETCH_ASSOC); $prepare->closeCursor(); - if ($method == 'rowCount') { - return $prepare->rowCount(); - } - return $prepare->{$method}(PDO::FETCH_ASSOC); + return $result; } catch (Throwable $throwable) { if ($this->isRefresh($throwable)) { return $this->search($method);