Skip to content

Commit

Permalink
Patch SQLite no error issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Dec 15, 2023
1 parent 5df9977 commit bac3f8e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Adapter/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ public function prepare(mixed $sql): Sqlite
}

$this->statement = $this->connection->prepare($sql);

if ($this->statement === false) {
if (($this->statement === false) && ($this->connection->lastErrorCode() != 0)) {
if ($this->profiler !== null) {
$this->profiler->addStep();
$this->profiler->current->setQuery($sql);
Expand Down Expand Up @@ -338,7 +337,7 @@ public function execute(): Sqlite

$this->result = $this->statement->execute();

if ($this->result === false) {
if (($this->result === false) && ($this->connection->lastErrorCode() != 0)) {
if ($this->profiler !== null) {
$this->profiler->current->addError($this->connection->lastErrorMsg(), $this->connection->lastErrorCode());
}
Expand Down Expand Up @@ -433,7 +432,7 @@ public function getNumberOfRows(): int
if ($this->lastSql === null) {
$count = $this->connection->changes();
} else {
if (!($this->lastResult = $this->connection->query($this->lastSql))) {
if ((!($this->lastResult = $this->connection->query($this->lastSql)) && ($this->connection->lastErrorCode() != 0))) {
$this->throwError(
'Error: ' . $this->connection->lastErrorCode() . ' => ' . $this->connection->lastErrorMsg()
);
Expand Down

0 comments on commit bac3f8e

Please sign in to comment.