MySQLdb now supports transactions if the server supports
transaction-safe tables (TSTs) and you are using them. If your server
doesn't support them, rollbacks will always fail, as they should,
because it can't do what you asked. Even if your server does support
them, rollbacks will fail if you modified any non-TST tables.
OTOH, cursor.commit(), which attempts to commit the
transaction to the database, always succeeds, because MySQL
essentially is always in auto-commit mode (unless you told it
First answer: Don't, if you can avoid it. Your program will not be
portable to other databases.
Second answer: Nearly all the special API calls are implemented on
the _mysql connection object, and the MySQLdb connection object can
also invoke them. See the built-in module docs to find out what ones
are implemented, and the MySQL C API docs to see what they do.
Well, it may be appropriate in some cirumstances. ZMySQLDA
does this, because Zope's ZRDB module is an API in itself, and too
many layers of APIs tend to make a mess of things. Besides, it was
actually pretty easy to do it that way and it probably improves the
performance a bit.
Read the MySQL docs, particularly the C API, for an overview.
Read the MySQLdb docs. This shows how the C API is transliterated
into Python. Plus some examplesa are in there.
Read the MySQLdb sources, particularly MySQLdb/cursors.py. That one
file contains most of the gory details, particularly in the
execute and _query methods.