Skip to content

SQLGetStmtAttr

SQLGetStmtAttr#

SQLGetStmtAttr retrieves the attributes related to the current statement handle.

SQLGetStmtAttrW() as a Unicode string supports same execution as SQLGetStmtAttr().

Syntax#

SQLRETURN  SQLGetStmtAttr (
    SQLHSTMT        stmt,
    SQLINTEGER      Attribute,
    SQLPOINTER      param,
    SQLINTEGER      StringLength
    SQLINTEGER *    StringLengthPtr );

Arguments#

Data Type Argument In/Output Description
SQLHSTMT stmt Input Statement handle
SQLINTEGER Attribute Input Attribute to set.
Refer to SQLSetStmtAttr.
SQLPOINTER param Output Pointer of the value related to the attributeDepending on the Attribute, the param will be a 32-bit integer, the pointer of the Null-terminator, the binary pointer, or the value defined in the ODBC.
If Attribute is the unique value of the ODBC, param is the integral number with a sign.
SQLINTEGER StringLength Input If the Attribute has been defined in the ODBC and if the param indicates the character string or binary buffer, this argument must be the length of *param.
If the Attribute is defined in the ODBC and param is an integer, this Arguments will be ignored.
SQLINTEGER * StringLengthPtr Output Returns the length of the value returned to ValuePtr(excluding the NULLterminatior) .

Return Values#

SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_ERROR
SQL_INVALID_HANDLE

Description#

SQLGetStmtAttr() returns the attribute related to the statement handle. For the statement attribute or more information, refer to SQLSetStmtAttr().

Diagnosis#

SQLSTATE Descriptionb Comments
HY090 Invalid string or buffer length StringLength is smaller than 0.
HY092 Invalid attribute or option The value specified in the attribute argument is not supported by this driver.
HYC00 Option not implemented The value specified in the attribute argument of ODBC is valid but not supported by this driver.
SQLGetConnectAttr
SQLSetConnectAttr
SQLSetStmtAttr