Share this page

# lrd_fetchx

Fetches the next row in the result set.(ODBC only)

    LRDRET lrd_fetchx( LRD_CURSOR *mptCursor, long mliRequestedRows, long mliRowsBatchSize, unsigned long *mpuliFetchedRows, LRD_PRINT_ROW_TYPEDEF mpfjPrintRow, long mliOption, 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.
mliOption | One of the LRD_FETCHX_ODBC_OPT options.
miDBErrorSeverity | The Error Severity Levels of a failure in a database routine.

The lrd_fetchx function fetches the next rows from the result set using an extended fetch (SQLExtendedFetch). In recorded scripts, the number of rows in the result set is the absolute value of the parameter, mliRequestedRows. For example, if the second parameter of lrd_fetchx is -14, fourteen rows of data were retrieved.

lrd_fetchx (Csr1, -14, 1, 0, PrintRow24, LRD_FETCHX_ODBC_OPT_EXT, 0);

Note: When you execute an lrd_fetchx 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.

Note that 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.

## Return Values

See LRD Return Values.

## Parameterization

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

## Example

In the following example, a SELECT statement retrieves all of the database records that contain a value of 1000 or greater in their SAL column. lrd_exec executes the statement and lrd_bind_col binds all the host variables to columns. The lrd_fetchx function gets the data and prepares it for display in a grid using an ODBC extended fetch.

     /* Set up and execute the SQL statement. */

    lr_think_time (76);
    lrd_stmt(Csr1, "select ename from emp where (sal>=1000)\n", -1, 1, 1, 0);
    lrd_bind_col(Csr1, 1, &D21_ENAME, 0);
    lrd_exec(Csr1, 0, 0, 0, 0);
    lrd_fetchx(Csr1, -3, 1, 0, PrintRow24, LRD_FETCHX_ODBC_OPT_EXT, 0);

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: