DB::CLOSE_ROW 1g 2025-09-11 laplante@plcb.ca GOWEB/Database


title: “DB::CLOSE_ROW Function” date: 2025-09-11 author: “laplante@plcb.ca” version: “1.0.1”

module: “GOWEB/Database”

Name

db::close_row Free Allocated Memory for SQL Row

Synopsis

db::closeRow or closeRow(id) db::close_row or close_row(id)

Description

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.

Examples

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"]]}
.

Author

laplante@plcb.ca

See also

Version History