Database Vuser Functions (LRD) > Alphabetical List of Functions > lrd_fetch_adv

lrd_fetch_adv

Example: lrd_fetch_adv Retrieval 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 );

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.
mliOption One of the LRD_FETCHX_ODBC_OPT options.
miDBErrorSeverity The severity of a failure in a database routine.
mlilFetchOffset The result set number.
musOrientation The FetchOrientation, can have one of the following values:    LRD_ORIENT_ODBC_OPT_PRIOR
LRD_ORIENT_ODBC_OPT_FIRST
LRD_ORIENT_ODBC_OPT_LAST
LRD_ORIENT_ODBC_OPT_ABSOLUTE
LRD_ORIENT_ODBC_OPT_RELATIVE
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.

Parameterization

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