SQLGetStmtAttr - Get the value of a statement attribute
SQLGetStmtAttr() returns
the current settings of the specified statement attribute.
These options are set
using the SQLSetStmtAttr() function. This function
is similar to SQLGetStmtOption(). Both functions
are supported for compatibility reasons.
Unicode (UTF-16) equivalent: This function
can also be used with the Unicode (UTF-16) character set. The corresponding
Unicode function is SQLGetStmtAttrW(). Refer to Unicode in Db2 for i CLI for more information about Unicode
support for DB2® CLI.
Syntax
SQLRETURN SQLGetStmtAttr( SQLHSTMT hstmt,
SQLINTEGER fAttr,
SQLPOINTER pvParam,
SQLINTEGER bLen,
SQLINTEGER *sLen); Function arguments
| Data type | Argument | Use | Description |
|---|---|---|---|
| SQLHSTMT | hstmt | Input | Statement handle. |
| SQLINTEGER | fAttr | Input | Attribute to retrieve. Refer to Table 2 for more information. |
| SQLPOINTER | pvParam | Output | Pointer to buffer for requested attribute. |
| SQLINTEGER | bLen | Input | Maximum number of bytes to store in pvParam, if the attribute is a character string; otherwise, unused. |
| SQLINTEGER * | sLen | Output | Length of output data if the attribute is a character string; otherwise, unused. |
Usage
| fAttr | Data type | Contents |
|---|---|---|
| SQL_ATTR_APP_PARAM_DESC | Integer | The descriptor handle used by the application to provide parameter values for this statement handle. |
| SQL_ATTR_APP_ROW_DESC | Integer | The descriptor handle for the application to retrieve row data using the statement handle. |
| SQL_ATTR_CURSOR_SCROLLABLE | Integer | A 32-bit integer value that specifies
if cursors opened for this statement handle should be scrollable.
|
| SQL_ATTR_CURSOR_TYPE | Integer | A 32-bit integer value that specifies
the behavior of cursors opened for this statement handle.
|
| SQL_ATTR_CURSOR_SENSITIVITY | Integer | The cursor sensitivity.
|
| SQL_ATTR_CURSOR_HOLD | Integer | Returns the HOLDABILITY for the cursor
for the statement.
|
| SQL_ATTR_FOR_FETCH_ONLY | Integer | This indicates if cursors opened
for this statement handle should be read-only.
|
| SQL_ATTR_IMP_PARAM_DESC | Integer | The descriptor handle used by the CLI implementation to provide parameter values for this statement handle. |
| SQL_ATTR_IMP_ROW_DESC | Integer | The descriptor handle used by the CLI implementation to retrieve row data using this statement handle. |
| SQL_ATTR_ROWSET_SIZE | Integer | A 32–bit integer value that specifies
the number of rows in the rowset. This is the number of rows returned
by each call to SQLExtendedFetch(). The default value
is 1. |
| SQL_ATTR_PARAM_BIND_TYPE | Integer | The binding used for the parameters.
|
| SQL_ATTR_ROW_BIND_TYPE | Integer | The binding used for rows.
|
| SQL_ATTR_PARAMSET_SIZE | Integer | Returns the number of rows for each multiple row statement. These include INSERT, MERGE, and UPDATE statements. |
Return codes
- SQL_SUCCESS
- SQL_SUCCESS_WITH_INFO
- SQL_ERROR
- SQL_INVALID_HANDLE
- SQL_NO_DATA
Diagnostics
| SQLSTATE | Description | Explanation |
|---|---|---|
| HY001 | Memory allocation failure | The driver is unable to allocate memory required to support the processing or completion of the function. |
| HY009 | Argument value that is not valid | The argument pvParam is a
null pointer. An fAttr that is not valid value is specified. |
| HYC00 | Driver not capable | Db2 for i CLI recognizes the option but does not support it. |