[DB-SIG] Behaviour of .commit()/.rollback() when autocommit=True

Keating, Tim TKeating at origin.ea.com
Mon Nov 17 10:47:17 EST 2003


These should do exactly what they do now when called on a session that has nothing to commit or rollback. 

-----Original Message-----
From: db-sig-bounces at python.org [mailto:db-sig-bounces at python.org] On Behalf Of Gerhard Häring
Sent: Monday, November 17, 2003 9:44 AM
To: db-sig at python.org
Subject: [DB-SIG] Behaviour of .commit()/.rollback() when autocommit=True

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


_______________________________________________
DB-SIG maillist  -  DB-SIG at python.org
http://mail.python.org/mailman/listinfo/db-sig




More information about the DB-SIG mailing list