Installation guide

mxODBC - Python ODBC Database Interface
Some databases for which mxODBC provides special subpackages such as MySQL
don't have transaction support, since the database does not provide transaction
support. For these subpackages, the
.rollback() connection method is not
available at all (i.e. calling it produces an
AttributeError) and the
clear_auto_commit flag on connection constructors defaults to 0.
5.5.3 Adjusting the Connection Commit Mode
You can adjust the connection's commit mode after creating it using the
connection.autocommit attribute. Setting the attribute to True will cause the
connection to operate in auto-commit mode again. Setting it to
False will have
the connection use manual commit. The attribute also allows querying the current
commit mode in the same way.
Alternatively, you can use a
connection.setconnectoption(SQL.AUTOCOMMIT,
SQL.AUTOCOMMIT_ON)
call to turn on auto commit and
connection.setconnectoption(SQL.AUTOCOMMIT, SQL.AUTOCOMMIT_OFF) to
turn it off again. Similarly,
connection.getconnectoption(SQL.AUTOCOMMIT)
will return the current option value (as tuple).
5.6 Stored Procedures
mxODBC provides several ways to call stored procedures in databases and
supports input, input/output and output parameters to make integration with
existing database systems easy:
1. directly using the
.callproc() cursor method, or
2. using the standard ODBC syntax for calling stored procedures and using
the standard
.execute*() cursor methods to initiate the calls.
5.6.1 Calling Stored Procedures with .callproc()
The .callproc() cursor method is very straight forward way of calling stored
procedures:
results = cursor.callproc("myprocedure", parameters)
When using this notation, mxODBC will call the procedure named
"myprocedure" with the variables given in the sequence parameters and return
a list copy of the parameters as
results.
Parameters are bound to the procedure parameters by position, just as is done for
the
.execute*() methods when using the 'qmark' parameter style.
68