Using Retrieval Procedures

For row-returning statements, such as Select statements or stored procedures, ODBC provides three ways to retrieve data. Using a single function call, an application can retrieve a single value, an entire row of values, or multiple rows of values. The PeopleSoft driver supports only the first two methods: single value and entire row.

One way that an application can retrieve data is by using a function call (SQLGetData) for every column in every row. The application supplies function arguments that specify the column number and a variable in which to receive the data. After the function call has been successfully executed, the value for the given column is returned in the variable. The application uses two loops to retrieve an entire result set, as in this example:

/* For all rows */
while (SQL_SUCCESS == (rc = SQLFetch(hstmt)))
   /* for all columns in current results set */
   for (colnum = 1; colnum <= columns; colnum++)
      SQLGetData(hstmt, colnum, ..., &value, ..)

SQLGetData is also used for the piecemeal retrieval of large text and binary data (such as images). It is often difficult or impossible for an application to allocate a single piece of memory big enough to hold a large data object, such as a 50-page document or a high-density bitmap.