[DB-SIG] DB API compliance test--clarification

M.-A. Lemburg mal@lemburg.com
Tue, 11 Mar 2003 20:40:11 +0100

Andy Dustman wrote:
> On Mon, 2003-02-17 at 03:00, M.-A. Lemburg wrote:
>>David Rushby wrote:
>>>Code snippet from Stuart's DB API compliance suite:
>>>def test_commit(self):
>>>    con = self._connect()
>>>    try:
>>>        # Commit must work, even if it doesn't do anything
>>>        con.commit()
>>>    finally:
>>>        con.close()
>>>Is it reasonable to commit a transaction without ever having created
>>You create the transaction implicitly by connecting to the database.
> Transactions are implicitly created when you execute a statement that
> changes the state of the database (INSERT, UPDATE, DELETE), or retrieves
> data (SELECT). Note that in at least some cases (MySQL), CREATE and DROP
> TABLE are NOT transactional. 

Then again, calling MySQL a transactional database is a bit far-
fetched ;-) It is true, however, that some databases have
non-transactional statements. Dropping a table and then expecting
the database to undo this with a .rollback() is something
you shouldn't really try in real life :-)

> Some examples of this:
 > ...

Ok, so the above check should execute at least one statement
on the connection, e.g. do a select. That should cover all

Marc-Andre Lemburg

Professional Python Software directly from the Source  (#1, Mar 11 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
Python UK 2003, Oxford:                                     21 days left
EuroPython 2003, Charleroi, Belgium:                       105 days left