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


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

module: “GOWEB/Database”

Name

db::next_row — retrieve the next row from an SQL query result

Synopsis

db::next_row or next_row(id) db::nextRow or nextRow(id)

Description

The db::next_row function retrieves the next row from the result of an SQL query. It returns true if there is more data available, or false if no rows remain. The parameter id must be the variable returned by the sql function.

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++;
        }
        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