DB_FetchPrev Function


Retrieves the previous row from the database. If the current row is the first row in the database, this function returns a status value of FALSE. If the returned status value is TRUE, the retrieved row becomes the current row.


status = DB_FetchPrev (hstmnt, ...)
Variable Description

Status of the fetch operation. If there was a previous row to retrieve, returns TRUE. If a previous row could not be retrieved, returns FALSE. If the database does not support reverse fetching, returns FALSE and an error. If the specified handle, hstmnt, is invalid, returns FALSE and an error. BOOLEAN.


The returned handle to the executed SQL statement. This is an input parameter for other DBTester functions, for example DB_FetchNext. HSQL.


A list of output arguments representing the columns of the database row. Supply a variable of the type of each column in the row in sequential order. If the supplied arguments do not match the data types of the corresponding database fields, the function returns a type mismatch error.

The list is of variable length. This means you can specify the first n columns of the row instead of supplying variables for the entire row. The output variables are filled starting with the first column in the row and continuing sequentially through the row until the function runs out of variables. Alternatively, you can specify a single list variable. Since the list length is dynamic, you will receive all the columns of the row. Likewise, you may specify a record variable that may or may not have fields for all the columns.


When you receive a valid statement handle from a DB_ExecuteSql function that specified a Select SQL command, you can issue DB_FetchPrev calls, if the database supports these, until you perform a DB_FinishSql function for that statement handle and thereby delete the handle.


STRING category 
// fetch the first two fields of the row
bStatus = DB_FetchPrev (hstmnt, index, category)