dbQuerySeekNext

Purpose

Retrieves the next record in the result, if available, and positions the query on the retrieved record.

Format

ret = dbQuerySeekNext(qid)
Parameters:qid (scalar) – query number.
Returns:ret (scalar) – if the record could not be retrieved, the result is positioned after the last record and 0 is returned. If the record is successfully retrieved, 1 is returned.

Examples

// Create and prepare query
qid = dbCreateQuery(db_id, "SELECT * FROM PEOPLE");

do while dbQuerySeekNext(qid);
    row = dbQueryFetchOneSA(qid);
    /*
    ** Or dbQueryFetchOneM(qid) if data
    ** is numeric
    */
endo;

Remarks

Note that the result must be in the active state before calling this function or it will do nothing and return 0. You can verify the status of the query with dbQueryIsSelect().

The following rules apply:

Result location Action taken
Before the first record An attempt is made to retrieve the first record.
After the last record There is no change and 0 is returned.
Somewhere between first and last record An attempt is made to retrieve the next record.