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

David Rushby davidrushby@yahoo.com
Sun, 16 Feb 2003 17:09:39 -0800 (PST)

Code snippet from Stuart's DB API compliance suite:

def test_commit(self):
    con = self._connect()
        # Commit must work, even if it doesn't do anything

Is it reasonable to commit a transaction without ever having created

It seems to me that this behavior is likely to give rise to subtle
errors, as when the programmer thinks he's made some changes to the
database without having actually done so (without even having
established a transaction), and the commit() call doesn't complain
about the lack of an active transaction.

kinterbasdb (Interbase/Firebird driver) currently raises the following
exception in this situation:

ProgrammingError: (-901, 'There is no active transaction to commit.
Consider using begin() to explicitly start a transaction in advance of
this commit() call.')

If allow-commit-of-a-nonexistent-transaction is really the convention
in the Python DB API community, I'll change kinterbasdb to conform to
it, but I don't like it.

Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day