Rowset retrieval examples in CLI applications
The rowset is a cache that holds predefined rows of data that are returned in the result set.
Partial rowset example
The application
cannot assume that the entire rowset will contain data. It must check
the row status array after each rowset is created to determine the
number of rows returned, because there are instances where the rowset
will not contain a complete set of rows. For instance, consider the
case where the rowset size is set to 10, and SQLFetchScroll() is
called using SQL_FETCH_ABSOLUTE and FetchOffset is
set to -3. This will attempt to return 10 rows starting 3 rows from
the end of the result set. Only the first three rows of the rowset
will contain meaningful data, however, and the application must ignore
the rest of the rows.

Fetch orientations example
The following
figure demonstrates a number of calls to
SQLFetchScroll() using
various FetchOrientation values. The result
set includes all of the rows (from 1 to n), and the rowset size is
3. The order of the calls and the FetchOrientation values
are as follows:- SQL_FETCH_LAST
- SQL_FETCH_FIRST
- SQL_FETCH_NEXT
- SQL_FETCH_RELATIVE
- SQL_FETCH_ABSOLUTE
