SQLSetDescField - Set a descriptor field

Purpose

SQLSetDescField() sets a field in a descriptor. SQLSetDescField() is a more extensible alternative to the SQLSetDescRec() function.

Syntax

SQLRETURN SQLSetDescField  (SQLHDESC       hdesc,
                            SQLSMALLINT    irec,
                            SQLSMALLINT    fDescType,
                            SQLPOINTER     rgbDesc,
                            SQLINTEGER     bLen);

Function arguments

Table 1. SQLSetDescField arguments
Data type Argument Use Description
SQLHDESC hdesc Input Descriptor handle.
SQLSMALLINT irec Input Record number from which the specified field is to be retrieved.
SQLSMALLINT fDescType Input See Table 2.
SQLPOINTER rgbDesc Input Pointer to buffer.
SQLINTEGER bLen Input Length of descriptor buffer (rgbDesc).
Table 2. fDescType descriptor types
Descriptor Type Description
SQL_DESC_COUNT SMALLINT Set the number of records in the descriptor. irec is ignored.
SQL_DESC_DATA_PTR SQLPOINTER Set the data pointer field for irec.
SQL_DESC_DATETIME_INTERVAL_CODE SMALLINT Set the interval code for records with a type of SQL_DATETIME
SQL_DESC_INDICATOR_PTR SQLPOINTER Set the indicator pointer field for irec.
SQL_DESC_LENGTH_PTR SQLPOINTER Set the length pointer field for irec.
SQL_DESC_LENGTH INTEGER Set the length field of irec.
SQL_DESC_PRECISION SMALLINT Set the precision field of irec.
SQL_DESC_SCALE SMALLINT Set the scale field of irec.
SQL_DESC_TYPE SMALLINT Set the type field of irec.

Usage

Instead of requiring an entire set of arguments like SQLSetDescRec(), SQLSetDescField() specifies which attribute you want to set for a specific descriptor record.

Although SQLSetDescField() allows for future extensions, it requires more calls to set the same information than SQLSetDescRec() for each descriptor record.

Return codes

Diagnostics

Table 3. SQLGetDescField SQLSTATEs
SQLSTATE Description Explanation
HY009 Argument value that is not valid The value specified for the argument fDescType or irec is not valid.

The argument rgbValue is a null pointer.

HY013 * Memory management problem The driver is unable to access memory required to support the processing or completion of the function.
HY021 Internal descriptor that is not valid The internal descriptor cannot be addressed or allocated, or it contains a value that is not valid.

References