fix: [FreeTDS][SQL Server]Invalid cursor state

This commit is contained in:
Guillermo Pages
2021-09-13 18:30:28 +02:00
parent 559558a530
commit a2a07ceccf

View File

@@ -29,19 +29,15 @@ class Connection
$success = $statement->execute(!empty($values) ? $values : null); $success = $statement->execute(!empty($values) ? $values : null);
if (!$success) { if (!$success) {
$statement->closeCursor();
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); $rows = $statement->fetchAll($fetchMode);
if (!is_array($rows)) { if (!is_array($rows)) {
$statement->closeCursor();
throw new SqlException('PDO Unable to retrieve the result'); throw new SqlException('PDO Unable to retrieve the result');
} }
$statement->closeCursor();
return new OdbcResultSet($rows); return new OdbcResultSet($rows);
} }