SQLGetDescRec - Get descriptor record
SQLGetDescRec() obtains an entire record from a descriptor. SQLGetDescRec() is a more concise alternative to the SQLGetDescField() function.
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
Table 1. SQLGetDescRec arguments Data type Argument Use Description SQLHDESC hdesc Input Descriptor handle. SQLSMALLINT irec Input The number of records in the descriptor matches the number of columns in the result set for a row descriptor, or the number of parameters in a parameter descriptor. 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
Table 2. SQLGetDescRec SQLSTATEs 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.
References
- SQLBindCol - Bind a column to an application variable
- SQLDescribeCol - Describe column attributes
- SQLExecDirect - Execute a statement directly
- SQLExecute - Execute a statement
- SQLPrepare - Prepare a statement
Parent topic:
DB2 UDB CLI functions