SQLSetDescField - Set a descriptor field
SQLSetDescField() sets a field in a descriptor. SQLSetDescField() is a more extensible alternative to the SQLSetDescRec() function.
Unicode (UTF-16) equivalent:
This function can also be used with the Unicode (UTF-16) character
set. The corresponding Unicode function is SQLSetDescFieldW().
Refer to Unicode in DB2 for iCLI for more information
about Unicode support for DB2 CLI.
Syntax
SQLRETURN SQLSetDescField (SQLHDESC hdesc,
SQLSMALLINT irec,
SQLSMALLINT fDescType,
SQLPOINTER rgbDesc,
SQLINTEGER bLen);
Function 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). |
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
- SQL_SUCCESS
- SQL_SUCCESS_WITH_INFO
- SQL_ERROR
- SQL_INVALID_HANDLE
Diagnostics
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. |