dbQuerySeekLast#

Purpose#

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

Format#

ret = dbQuerySeekLast(qid)#
Parameters:

qid (scalar) – query number.

Returns:

ret (scalar) – returns 1 if successful. If unsuccessful the query position is set to an invalid position and 0 is returned.

Examples#

/*
** Given STATES is a table with all
** 50 states listed alphabetically
*/
qid = dbExecQuery(db_id, "SELECT name FROM STATES");

// Move to last state
ret = dbQuerySeekLast(qid);

// If 'ret' is equal to 0
if not  ret;
   print  "dbQuerySeekLast failed";
else;
   // Print last state: Wyoming
   print dbQueryFetchOneSA(qid);
endif;

Remarks#

Note that the result must be in the active state and dbQueryIsSelect() must return 1 before calling this function or it will do nothing and return 0.