Version: 7.0.0

SQLSetEnvAttr ​

Function ​

Sets environment attributes.

Prototype ​

c
SQLRETURN SQLSetEnvAttr(SQLHENV       EnvironmentHandle,
                        SQLINTEGER    Attribute,    
                        SQLPOINTER    ValuePtr,     
                        SQLINTEGER    StringLength);

Parameters ​

Table 1 SQLSetEnvAttr parameters

Keyword

Description

EnvironmentHandle

Environment handle.

Attribute

Environment attribute to be set. Currently, only SQL_ATTR_ODBC_VERSION is supported, which specifies the ODBC version. The default version is SQL_OV_ODBC3.

ValuePtr

Points to the value of the corresponding attribute. Depending on the attribute value, it can be a 32-bit integer value or points to a null-terminated string.

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 environment attribute failed to be set.

  • SQL_INVALID_HANDLE: The input handle is invalid.

Example ​

See: Example