Example: lrd_fetchRetrieval Handling Functions

Fetches the next row in the result set.

LRDRET lrd_fetch( LRD_CURSOR *mptCursor, long mliRequestedRows, long mliRowsBatchSize, unsigned long *mpuliFetchedRows, LRD_PRINT_ROW_TYPEDEF mpfjPrintRow, int miDBErrorSeverity);

mptCursor A pointer to an LRD_CURSOR structure.
mliRequestedRows The total number of rows to be fetched. A zero value fetches one row. A negative value fetches all rows.
mliRowsBatchSize The maximum number of rows to be fetched by a single database request.
mpuliFetchedRows A pointer to the actual number of rows fetched.
mpfjPrintRow A pointer to a function that prints each fetched row.
miDBErrorSeverity The Error Severity Levels of a failure in a database routine.

The lrd_fetch function fetches the next row from the result set. In recorded scripts, the number of rows in the result set is the absolute value of the parameter, mliRequestedRows. For example, if the second argumentof lrd_fetch, mliRequestedRows, is -14, fourteen rows of data were retrieved.

lrd_fetch(Csr1, -14, 1, 0, PrintRow24, 0);

If the second argument, mliRequestedRows, has a negative value, it indicates that all the rows in the result set were retrieved. A positive value indicates that only a portion of the results were retrieved.

Note: When you execute an lrd_fetch statement containing a negative row value, it retrieves all of the available rows in the table at the time of the run—not necessarily the number at the time of recording. In the above example, all fourteen rows of the table were retrieved during the recording session. However, if more rows are available during script execution, they are all retrieved.

The fourth argument, mpuliFetchedRows, provides the number of rows fetched during replay. You can specify a pointer to an integer variable as this argument and then access the variable after the fetch.

A single SQL statement can return multiple result sets. This function gets the next row from the current result set. If there are no more rows in the current result set, the next result set is made available.

For more details refer to the Function Header File lrd.h in the include directory.

Return Values

See LRD Return Values.


You cannot use standard parameterization for any arguments in this function.