[DB-SIG] Behaviour of .commit()/.rollback() when autocommit=True
mal at lemburg.com
Mon Nov 17 11:37:16 EST 2003
Gerhard Häring wrote:
> Several database modules seem to have a sort of unofficial extension -
> the autocommit mode, without transaction handling. I'd like to hear your
> opinion on what .commit()/.rollback() should do in this case.
The DB API 2.0 defines this case to be implemented according to
your option 1.
> Option 1)
> Behaviour: .commit() dies nothing, .rollback() raises an exception
> Rationale: this makes it easier to program applications that work in
> both autocommit mode and transactional mode, depending on the
> configuration or DB-API module used.
> Option 2)
> Behaviour: .commit() and .rollback() both raise an exception
> Rationale: There is nothing to commit or roll back, so these calls don't
> make any sense and the user should be alerted of this fact.
> Option 3)
> Behaviour: .commit() and .rollback() both do nothing.
> Rationale: (Almost) same as #1?
> Do you have any other suggestions? Which would you prefer?
> -- Gerhard
> DB-SIG maillist - DB-SIG at python.org
Professional Python Software directly from the Source (#1, Nov 17 2003)
>>> Python/Zope Products & Consulting ... http://www.egenix.com/
>>> mxODBC.Zope Database Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the DB-SIG