SQLGetDescRec - Get descriptor record
SQLGetDescRec() obtains an entire record from a descriptor. SQLGetDescRec() is a more concise alternative to the SQLGetDescField() function.
Unicode (UTF-16) equivalent: This function
can also be used with the Unicode (UTF-16) character set. The corresponding
Unicode function is SQLGetDescRecW(). Refer to Unicode in DB2 for iCLI for more information about Unicode
support for DB2 CLI.
Syntax
SQLRETURN SQLGetDescRec (SQLHDESC hdesc,
SQLSMALLINT irec,
SQLCHAR *rgbDesc,
SQLSMALLINT cbDescMax,
SQLSMALLINT *pcbDesc,
SQLSMALLINT *type,
SQLSMALLINT *subtype,
SQLINTEGER *length,
SQLSMALLINT *prec,
SQLSMALLINT *scale,
SQLSMALLINT *nullable);
Function arguments
Data type | Argument | Use | Description |
---|---|---|---|
SQLHDESC | hdesc | Input | Descriptor handle. |
SQLSMALLINT | irec | Input | Indicates the descriptor record from which the application seeks information. Descriptor records are numbered from 1, with the record number 1 being the first item in the descriptor. If the fDescType argument indicates a field of the descriptor header record ( SQL_DESC_ALLOC_TYPE or SQL_DESC_COUNT), irec must be 0. |
SQLCHAR * | rgbDesc | Output | NAME field for the record. |
SQLSMALLINT | cbDescMax | Input | Maximum number of bytes to store in rgbDesc. |
SQLSMALLINT * | pcbDesc | Output | Total length of the output data. |
SQLSMALLINT * | type | Output | TYPE field for the record. |
SQLSMALLINT * | subtype | Output | DATETIME_INTERVAL_CODE, for records whose TYPE is SQL_DATETIME. |
SQLINTEGER * | length | Output | LENGTH field for the record. |
SQLSMALLINT * | prec | Output | PRECISION field for the record. |
SQLSMALLINT * | scale | Output | SCALE field for the record. |
SQLSMALLINT * | nullable | Output | NULLABLE field for the record. |
Usage
Calling SQLGetDescRec() retrieves all the data from a descriptor record in one call. It might still be necessary to call SQLGetDescField() with SQL_DESC_COUNT to determine the number of records in the descriptor.
Return codes
- SQL_SUCCESS
- SQL_SUCCESS_WITH_INFO
- SQL_ERROR
- SQL_INVALID_HANDLE
- SQL_NO_DATA_FOUND
Diagnostics
SQLSTATE | Description | Explanation |
---|---|---|
HY009 | Argument value that is not valid | The value specified for the argument irec is
not valid. The argument rgbDesc, pcbDesc, type, subtype, length, prec, scale or nullable 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. |