Retrieval Procedures

This topic discusses the retrieval procedures in alphabetical order.

Syntax

RETCODE SQLFetch(hstmt)

Description

SQLFetch fetches a row of data from a result set. The driver returns data for all columns that were bound to storage locations with SQLBindCol. SQLFetch positions the cursor on the next row of the result set. When the cursor is positioned to the last row of the result set, SQLFetch returns SQL_NO_DATA_FOUND.

If the application called SQLBindCol to bind columns, SQLFetch stores data in the locations specified by the calls to SQLBindCol. If the application does not call SQLBindCol to bind any columns, SQLFetch does not return any data; it just moves the cursor to the next row. An application can call SQLGetData to retrieve data not previously bound to a storage location.

Parameters

This table describes the parameter:

Argument

Type

Use

Description

hstmt

HSTMT

Input

Statement handle.

Syntax

RETCODE SQLGetData(hstmt,icol,fCType,rbgValue,cbValueMax,pcbValue)

Description

SQLGetData returns result data for a single unbound column in the current row. The application must call SQLFetch to position the cursor on a row of data before it calls SQLGetData. You can use SQLBindCol for some columns and use SQLGetData for others within the same row. This function can be used to retrieve character or binary data values in parts from a column with a character, binary, or data-source-specific data type (for example, data from SQL_LONGVARBINARY or SQL_LONGVARCHAR columns).

Parameters

This table describes the parameters:

Argument

Type

Use

Description

hstmt

HSTMT

Input

Statement handle.

icol

UWORD

Input

Column number of result data.

fCType

SWORD

Input

The C data type of the result data.

rbgValue

PTR

Both

A pointer to storage for the result column.

cbValueMax

SDWORD

Input

Maximum length of the rgbValue buffer.

pcbValue

SDWORD FAR*

Both

A pointer to a buffer for the SQL_NULL_DATA or the number of bytes available to return in rgbValue prior to calling SQLFetch.