I wrote this code :
$stmt = $link->prepare($statement_string);
// [...]
$result_m = $stmt->result_metadata();
if ($result_m) {
$stmt->store_result();
// [...]
$stmt->free_result();
$result_m->free();
}
Is that code right ?
I read the doc mysqli-stmt.result-metadata and mysqli-result.free doc . I also read this post : ...free-mysql-result-after-storing-it but I didn't find my answer.
EDIT :
What I want to know is : will the $stmt->free_result();
just liberate some memory allocation done by $stmt->store_result();
or clearly free the memory of the mysqli_result
object built by $stmt->result_metadata();
?
according to these pages:
meta data and actual statement data (rows) are different objects so you must clear them both separately.
exactly as you did in your code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.