Installation guide
11. mxODBC Functions
This function is only available for ODBC 3.x compatible managers and ODBC
drivers.
Note:
The function allows setting environment attributes which mxODBC itself uses
to define the way it interfaces to the database. Changing these attributes can
result in unwanted behavior or even segmentation faults. USE AT YOUR OWN
RISK !
statistics()
Returns a tuple (connections, cursors) stating the number currently open
connections and cursors for this subpackage.
Note that broken connections or cursors are not correctly counted.
11.2 mx.ODBC Functions
In addition to subpackage specific helpers, mxODBC also provides a few
additional functions available through the top-level
mx.ODBC package. These are:
format_resultset(cursor, headers=None, colsep=' | ', headersep='-
', stringify=repr)
Fetch the result set from cursor and format it into a list of strings (one for each
row):
-header-
-headersep-
-row1-
-row2-
...
headers may be given as list of strings. It defaults to the header names from
cursor.description. The function will add numbered columns as
appropriate if it finds more columns than given in headers.
Columns are separated by
colsep; the header is separated from the result set
by a line of
headersep characters.
The function calls stringify to format the value data returned by the driver into
a string. It defaults to
repr().
print_resultset(cursor, headers=None)
Pretty-prints the current result set available through cursor.
See
format_resultset() for details on formatting.
167