diff --git a/Command.php b/Command.php index 3f58e49..8f2de37 100644 --- a/Command.php +++ b/Command.php @@ -117,7 +117,6 @@ class Command extends Component { $client = $this->connection->getConnection(); try { - $this->connection->println($this->sql, $this->params); if (($prepare = $client->prepare($this->sql)) === false) { throw new Exception('(' . $prepare->errorInfo()[0] . ')' . $client->errorInfo()[2]); } @@ -127,6 +126,8 @@ class Command extends Component $result = $method == 'rowCount' ? $prepare->rowCount() : $prepare->{$method}(PDO::FETCH_ASSOC); $prepare->closeCursor(); + $this->connection->println($this->sql, $this->params); + return $result; } catch (Throwable $throwable) { if ($this->isRefresh($throwable)) return $this->search($method); @@ -169,6 +170,8 @@ class Command extends Component $result = $client->lastInsertId(); + $this->connection->println($this->sql, $this->params); + return $result == 0 ? $prepare->rowCount() : (int)$result; } catch (Throwable $throwable) { if ($this->isRefresh($throwable)) return $this->_prepare();