Version: 7.0.0

SQLSetStmtAttr ​

Function ​

Sets statement attributes.

Prototype ​

c
SQLRETURN SQLSetStmtAttr(SQLHSTMT      StatementHandle,
                         SQLINTEGER    Attribute,    
                         SQLPOINTER    ValuePtr,     
                         SQLINTEGER    StringLength);

Parameters ​

Table 1 SQLSetStmtAttr parameters

Keyword

Parameter Description

StatementHandle

Statement handle.

Attribute

Statement attribute to be set. It can be one of the following values:

  • SQL_ATTR_QUERY_TIMEOUT: Specifies the SQL statement execution timeout.
  • SQL_ATTR_PARAMSET_SIZE: Specifies the number of parameter groups contained in a parameter set during batch execution.
  • SQL_ATTR_ROWS_FETCHED_PTR: Obtains the actual number of rows fetched.
  • SQL_ATTR_ROW_ARRAY_SIZE: Sets the maximum number of rows for batch fetching.

If the attribute to be set is not within the above range, the driver returns SQL_ERROR.

ValuePtr

Points to the value of the corresponding attribute. Depending on the attribute value, ValuePtr can be a 32-bit unsigned integer value, or points to a null-terminated string, a binary buffer, or a driver-defined value.

StringLength

If ValuePtr points to a string or a binary buffer, this parameter is the length of *ValuePtr. If ValuePtr points to an integer value, StringLength is ignored.

Return Values ​

  • SQL_SUCCESS: The call is successful.

  • SQL_SUCCESS_WITH_INFO: Some warning information is present.

  • SQL_ERROR: The statement attribute failed to be set.

  • SQL_INVALID_HANDLE: The input handle is invalid.

Example ​

See: Example