title: “DB::CLOSE_ROW Function” date: 2025-09-11 author: “laplante@plcb.ca” version: “1.0.1”
db::close_row Free Allocated Memory for SQL Row
db::closeRow or closeRow(id) db::close_row or close_row(id)
The db::close_row
function releases the memory allocated by sql
when used with the next_row
parameter.
The parameter id
must be the variable returned by the sql
function.
Although memory is automatically freed by default, calling db::close_row
explicitly allows for faster memory release during execution.
res={{
func f(n) {
n; "------------------\n";
res := sql(want_colname: true, want_array:true, next_row:true, "select * from test1 order by uid asc limit " + string(n));
i := 1;
for next_row(res) && i < 3 {
res; "\n";
i++;
}
close_row(row)
return;
}
f(5);
f(6);
}}.
return
res=5------------------
{"colname":["uid","lastname","firstname","age"],"nb_columns":4,"rows":[["1","ln1","fn1","1"]]}
{"colname":["uid","lastname","firstname","age"],"nb_columns":4,"rows":[["2","ln2","fn2","2"]]}
6------------------
{"colname":["uid","lastname","firstname","age"],"nb_columns":4,"rows":[["1","ln1","fn1","1"]]}
{"colname":["uid","lastname","firstname","age"],"nb_columns":4,"rows":[["2","ln2","fn2","2"]]}
.
laplante@plcb.ca