SQLSetConnectOption Mapping
Because the Driver Manager does not know whether the driver-defined connection
attribute needs a string or 32-bit integer value, it has to pass in a valid
value for the BufferLength argument of SQLSetConnectAttr. If the driver has defined special semantics for driver-defined connect
attributes and needs to be called using SQLSetConnectOption, then it must support SQLSetConnectOption.
If an ODBC 2.x application calls SQLSetConnectOption to set a driver-specific statement option in an ODBC 3.0 driver, and the
option was defined in an ODBC 2.x version of the driver, a new manifest constant should be defined for the
option in the ODBC 3.0 driver. If the old manifest constant is used in the call to SQLSetConnectOption, the Driver Manager will call SQLSetConnectAttr with the StringLength argument set to 0.
For an ODBC 3.0 driver, the Driver Manager no longer checks to see if fOption is in between SQL_CONN_OPT_MIN and SQL_CONN_OPT_MAX, or is greater than
SQL_CONNECT_OPT_DRVR_START.
Setting Statement Options on the Connection Level
In ODBC 2.x, an application could call SQLSetConnectOption to set a statement option. When that is done, the driver establishes the
statement option as a default for any statements later allocated for that
connection. It is driver-defined whether the driver sets the statement option for any
existing statements associated with the specified connection.
This ability has been deprecated in ODBC 3.0. ODBC 3.0 drivers need only
support setting ODBC 2.x statement attributes at the connection level if they want to work with ODBC 2.x applications that do this. ODBC 3.0 applications should never set statement
attributes at the connection level. ODBC 3.0 statement attributes cannot be set
at the connection level, with the exception of the SQL_ATTR_METADATA_ID and
SQL_ATTR_ASYNC_ENABLE attributes, which are both connection attributes and
statement attributes, and can be set either at the connection level or the statement
level.
If fOption indicates an ODBC-defined connection attribute that requires a string, then
the Driver Manager calls:
ValuePtr, SQL_NTS)
If fOption indicates an ODBC-defined connection attribute that returns a 32-bit integer
value, then the Driver Manager calls:
ValuePtr, 0)
If fOption indicates a driver-defined connection attribute, then the Driver Manager
calls: