[DB-SIG] Behaviour of .commit()/.rollback() when autocommit=True
Gerhard Häring
gh at ghaering.de
Mon Nov 17 10:44:25 EST 2003
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.
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
More information about the DB-SIG
mailing list