diff --git a/src/Dibi/Drivers/PdoResult.php b/src/Dibi/Drivers/PdoResult.php index d0e22371..a65b523f 100644 --- a/src/Dibi/Drivers/PdoResult.php +++ b/src/Dibi/Drivers/PdoResult.php @@ -30,6 +30,12 @@ public function __construct(\PDOStatement $resultSet, string $driverName) } + public function __destruct() + { + $this->resultSet?->closeCursor(); + } + + /** * Returns the number of rows in a result set. */ @@ -63,6 +69,7 @@ public function seek(int $row): bool */ public function free(): void { + $this->resultSet?->closeCursor(); $this->resultSet = null; } diff --git a/src/Dibi/Helpers.php b/src/Dibi/Helpers.php index 82bed671..eb0516c0 100644 --- a/src/Dibi/Helpers.php +++ b/src/Dibi/Helpers.php @@ -257,7 +257,7 @@ public static function loadFromFile(Connection $connection, string $file, ?calla } elseif (str_ends_with($ts = rtrim($s), $delimiter)) { $sql .= substr($ts, 0, -strlen($delimiter)); - $driver->query($sql); + $driver->query($sql)->free(); $sql = ''; $count++; if ($onProgress) { diff --git a/tests/databases.github.ini b/tests/databases.github.ini index 40aeb464..0bfd75e5 100644 --- a/tests/databases.github.ini +++ b/tests/databases.github.ini @@ -81,9 +81,9 @@ database = dibi_test port = 1433 system = sqlsrv -;[sqlsrv pdo] -;driver = pdo -;dsn = "sqlsrv:Server=localhost,1433;Database=dibi_test" -;user = SA -;password = "YourStrong!Passw0rd" -;system = sqlsrv +[sqlsrv pdo] +driver = pdo +dsn = "sqlsrv:Server=localhost,1433;Database=dibi_test" +user = SA +password = "YourStrong!Passw0rd" +system = sqlsrv