fix: bad cursor state

This commit is contained in:
Guillermo Pages
2021-09-13 19:49:50 +02:00
parent a2a07ceccf
commit 881693402a

View File

@@ -32,13 +32,17 @@ class Connection
throw new SqlException('SQL There was an error executing the request'); throw new SqlException('SQL There was an error executing the request');
} }
$rows = $statement->fetchAll($fetchMode); if (strpos($sql, "SELECT") !== false) {
$rows = $statement->fetchAll($fetchMode);
if (!is_array($rows)) { if (!is_array($rows)) {
throw new SqlException('PDO Unable to retrieve the result'); throw new SqlException('PDO Unable to retrieve the result');
}
return new OdbcResultSet($rows);
} }
return new OdbcResultSet($rows); $statement->closeCursor();
return true;
} }
/** /**