Retrieval of a result set into an array
An application can issue a query statement and fetch rows from the result set that the query generates.
To fetch rows, you typically bind application variables to columns
in the result set with
SQLBindCol(). Then you individually
fetch each row into these application variables. If you want to store
more than one row from the result set in your application, you can
follow each fetch with an additional operation. You can save previously
fetched values in your application by using one of the following operations
before you fetch additional data: - Copy fetched values to application variables that are not bound to a result set
- Call a new set of
SQLBindCol()functions to assign new application variables to the next fetch
Alternatively, you can retrieve multiple rows of data (called a
row set) simultaneously into an array. This method eliminates the
overhead of extra data copies or SQLBindCol() calls. SQLBindCol() can
bind an array of application variables. By default, SQLBindCol() binds
rows in column-wise fashion: this type of bind is similar to using SQLBindParameter() to
bind arrays of input parameter values, as described in the previous topic. You
can also bind data in a row-wise fashion to retrieve data into an
array.