Skip to content

Commit 47461b1

Browse files
committed
Merge pull request #296 from avbdr/master
close() prepared statement when its not needed anymore
2 parents 00824c1 + 08295f0 commit 47461b1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

MysqliDb.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,11 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
961961
$x[$key] = $val;
962962
}
963963
$this->count++;
964-
array_push($results, $x);
964+
array_push ($results, $x);
965965
}
966+
if ($shouldStoreResult)
967+
$stmt->free_result();
968+
$stmt->close();
966969
// stored procedures sometimes can return more then 1 resultset
967970
if ($this->mysqli()->more_results())
968971
$this->mysqli()->next_result();

tests/mysqliDbTests.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,6 @@ function createTable ($name, $data) {
400400
//print_r($db->rawQuery("CALL simpleproc(?)",Array("test")));
401401

402402
print_r ($db->trace);
403-
echo "All done";
403+
echo "All done\n";
404+
echo "Memory usage: ".memory_get_peak_usage()."\n";
404405
?>

0 commit comments

Comments
 (0)