Installation guide
mxODBC - Python ODBC Database Interface
11. mxODBC Functions
mxODBC includes a few helper functions and generic APIs which aid in everyday
ODBC database programming or allow introspection at the ODBC manager level.
The next sections describe these functions in detail.
11.1 Subpackage Functions
For some subpackages, mxODBC also defines a few helpers which you can use to
query additional information from the ODBC driver or manager. These are
available through the subpackage, e.g. as
mx.ODBC.Windows.DataSources().
DataSources()
This helper function is only available for ODBC managers and some ODBC
drivers which have internal ODBC manager support, e.g. IBM's DB2 ODBC
driver, and allows you to query the available data sources.
It returns a dictionary mapping data source names to descriptions
Notes:
Older versions of unixODBC had a bug in some versions which makes the
manager only return information about data sources on the first call to this
function. Older versions of iODBC truncated the descriptions to two
characters.
getenvattr(option)
Returns the given ODBC environment option. This method interfaces directly
to the ODBC function
SQLGetEnvAttr().
option must be an integer. Suitable option values are available through the
SQL singleton object.
The method returns the data as 32-bit integer. It is up to the caller to decode
the integer using the SQL defines.
This function is only available for ODBC 3.x compatible managers and ODBC
drivers.
setenvattr(option, value)
This function lets you set ODBC environment attributes which are encoded as
32-bit integers.
This method interfaces directly to the ODBC function
SQLSetEnvAttr().
option must be an integer. Suitable option values are available through the
SQL singleton object.
166