Example: lrd_fetch_advRetrieval Handling Functions

Fetches multiple rows from the result set. (ODBC only)

LRDRET lrd_fetch_adv( LRD_CURSOR *mptCursor, long mliRequestedRows, long mliRowsBatchSize, unsigned long *mpuliFetchedRows, LRD_PRINT_ROW_TYPEDEF mpfjPrintRow, long mliOption, int miDBErrorSeverity, long mlilFetchOffset, unsigned short musOrientation );

mptCursorA pointer to an LRD  CURSOR structure.
mliRequestedRowsThe total number of rows to be fetched. A zero value fetches one row. A negative value fetches all rows.
mliRowsBatchSizeThe maximum number of rows to be fetched by a single database request.
mpuliFetchedRowsA pointer to the actual number of rows fetched.
mpfjPrintRowA pointer to a function that prints each fetched row.
mliOptionOne of the LRD_FETCHX_ODBC_OPT options.
miDBErrorSeverityThe severity of a failure in a database routine.
mlilFetchOffsetThe result set number.
musOrientationThe FetchOrientation, can have one of the following values:    LRD_ORIENT_ODBC_OPT_PRIOR
LRD_ORIENT_ODBC_OPT_BOOKMARKThese options correspond to the ODBC SQL_FETCH_ options for SQLExtendedFetch and SQLScrollFetch.

The lrd_fetch_adv function fetches multiple rows from a result set using an ODBC extended fetch (SQLExtendedFetch). In recorded scripts, the number of rows in the result set is the absolute value of the parameter, mliRequestedRows.

When you execute an lrd_fetch_adv 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 of rows at the time of recording. If more rows are available during script execution, they are all retrieved.

Note that a single SQL statement can return multiple result sets, so the result set number must also be specified.

Return Values

See LRD Return Values.


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