Contents|Index|Previous|Next

SQLGetConnectOption Mapping

When an application calls SQLGetConnectOption through an ODBC 3.0 driver, the call to:

SQLGetConnectOption(hdbc, fOption, pvParam)

is mapped as follows:

odbc00090000.gif If fOption indicates an ODBC-defined connection option that returns a string, then the Driver Manager calls:

SQLGetConnectAttr(ConnectionHandle, Attribute,
ValuePtr, BufferLength, NULL)

odbc00090000.gif If fOption indicates an ODBC-defined connection option that returns a 32-bit integer value, then the Driver Manager calls:

SQLGetConnectAttr(ConnectionHandle, Attribute,
ValuePtr, 0, NULL)

odbc00090000.gif If fOption indicates a driver-defined statement option, then the Driver Manager calls:

SQLGetConnectAttr(ConnectionHandle, Attribute,
ValuePtr, BufferLength, NULL)

In these three cases, the ConnectionHandle argument is set to the value in hdbc, the Attribute argument set to the value in fOption, and the ValuePtr argument set to the same value as pvParam.

For ODBC-defined string connection options, the Driver Manager sets the BufferLength argument in the call to SQLGetConnectAttr to the predefined maximum length (SQL_MAX_OPTION_STRING_LENGTH); for a non-string connection option, BufferLength is set to 0.

For an ODBC 3.0 driver, the Driver Manager no longer checks to see if Option is in between SQL_CONN_OPT_MIN and SQL_CONN_OPT_MAX, or is greater than SQL_CONNECT_OPT_DRVR_START. The driver must check the validity of the option values.