SQLGetStmtOption - Return current setting of a statement option

SQLGetStmtOption() has been deprecated and replaced with SQLGetStmtAttr(). Although this version of DB2® for i CLI continues to support SQLGetStmtOption(), it is recommended that you begin using SQLGetStmtAttr() in your DB2 for i CLI programs so that they conform to the latest standards.

SQLGetStmtOption() returns the current settings of the specified statement option.

These options are set using the SQLSetStmtOption() function.

Unicode (UTF-16) equivalent: This function can also be used with the Unicode (UTF-16) character set. The corresponding Unicode function is SQLGetStmtOptionW(). Refer to Unicode in DB2 for iCLI for more information about Unicode support for DB2 CLI.

Syntax

SQLRETURN SQLGetStmtOption( SQLHSTMT        hstmt,
                            SQLSMALLINT     fOption,
                            SQLPOINTER      pvParam);

Function arguments

Table 1. SQLStmtOption arguments
Data type Argument Use Description
SQLHSTMT hstmt Input Connection handle.
SQLSMALLINT fOption Input Option to retrieve. See Table 2 for more information.
SQLPOINTER pvParam Output Value of the option. Depending on the value of fOption this can be a 32-bit integer value, or a pointer to a null terminated character string.

Usage

SQLGetStmtOption() provides the same function as SQLGetStmtAttr(), both functions are supported for compatibility reasons.

See Table 2 for a list of statement options.

Return codes

  • SQL_SUCCESS
  • SQL_SUCCESS_WITH_INFO
  • SQL_ERROR
  • SQL_INVALID_HANDLE

Diagnostics

Table 2. SQLStmtOption SQLSTATEs
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.

A fOption that is not valid value is specified.

HYC00 Driver not capable DB2 for i CLI recognizes the option but does not support it.