[DB-SIG] DB API extension suggestion

Carsten Haese carsten at uniqsys.com
Fri Jun 22 05:28:19 CEST 2007


On Thu, 2007-06-21 at 16:39 -0600, Anthony Tuininga wrote:
> I have not released this publicly yet, no. It would be a good idea to
> have agreement on this rather than have conflicting implementations.

Indeed. I see two alternatives, modulo naming:

1) A connection method:

with conn.transaction(): ...

2) A module function:

with api.transaction(conn): ...

Implementing 2) would require nothing more than an almost verbatim
implementation of example 3 from pep-0343, but I personally would prefer
1) because it looks cleaner in application code.

As far as the interaction with existing transactions is concerned, I
think that continuing an existing transaction is the easiest and least
surprising behavior.

If the module supports autocommit and the connection is in autocommit
mode, it should leave autocommit mode upon entering the transaction
block and reenter autocommit mode upon leaving the transaction block.

-- 
Carsten Haese
http://informixdb.sourceforge.net




More information about the DB-SIG mailing list