Installation guide
6. mxODBC Connection Objects
The
connection.encoding is used on connection related APIs and also
passed to cursors created on the connection at creation time. Cursors store the
encoding in
cursor.encoding and cursor related APIs will use the cursor
setting instead of the connection setting.
.errorhandler
Read/write attribute which defines the error handler function to use. If set to
None, the default handling is used, i.e. errors and warnings all raise an
exception and get appended to the
.messages list.
An error handler must be a callable object taking the arguments
(connection, cursor, errorclass, errorvalue) where connection is
a reference to the connection,
cursor a reference to the cursor (or None in
case the error does not apply to a cursor),
errorclass is an error class which
to instantiate using
errorvalue as construction argument.
See section 10.4 Error Handlers for more details on how to use error handlers.
.license
String with the license information of the installed mxODBC license.
.messages
This is a Python list object to which mxODBC appends tuples (exception
class, exception value)
for all messages which the interfaces receives
from the underlying ODBC driver or manager for this connection.
The list is cleared automatically by all connection methods calls (prior to
executing the call) except for the info and connection option methods calls to
avoid excessive memory usage and can also be cleared by executing
del
connection.messages[:].
All error and warning messages generated by the ODBC driver are placed into
this list, so checking the list allows you to verify correct operation of the
method calls.
.paramstyle
Sets the default parameter binding style for cursors created on this connection,
i.e. all cursors created on the connection will use
connection.paramstyle as
their default
cursor.paramstyle value.
The attribute can be set or queried and takes the following string values
(following the
paramstyle module global as defined in the DB-API):
'qmark' (default)
This is the default ODBC parameter binding style and also used as native
database binding style by MS SQL Server and IBM DB2.
Parameters in SQL statements used on
cursor.execute*() methods are
marked with the question mark letter (
'?') and the variables are bound to
these parameter locations using a positional mapping. Parameter values for
a SQL statement must be specified as sequence, normally a list or a tuple.
97