[DB-SIG] Python 2.0 DB Api - Threading and Transactions not known until connected

Brad Clements bkc@murkworks.com
Wed, 25 Aug 1999 14:27:39 -0400


On 25 Aug 99, at 18:44, M.-A. Lemburg wrote:

> I'd suggest setting the module level variable to the lowest
> level and then add a per connection attribute as you indicated.

Ok.

> When the cursor is created an implicit transactions start is
> performed. This is normal SQL behaviour. You don't need to do
> a .commit() to start a new transaction.

True but, I need to tell ADO that I want to support transactions. If the 
user never calls commit, how do I know that I should enable 
transactions?


> 
> Auto-commit is enabled per default for ODBC. Since it renders

ADO doesn't have to use ODBC, in fact I suspect most folks won't be 
using the ODBC driver via ADO. 

The "Ole DB SQL Provider" and also, I think, the Oracle one, assume 
that transactions are not used unless I turn them on.

If I just enable transactions, then do a  BeginTransaction when issuing a 
cursor, how do I know when to do a Commit() since auto-commit is 
supposed to be disabled, and the user may never call 
connection.commit()?

> Make the .rollback() method dynamically defined, i.e. have it
> disabled on connections that do not support transactions. An explicit
> "begin transaction" is not needed since this always happens
> implicitly when you call connection.cursor() or cursor.commit()/
> .rollback().


Er, well, I can't find in the 2.0 spec anywhere that it says that 
constructing a new cursor automatically begins a transaction.

My DA has to explicitely call the underlying begin, commit and rollback 
as appropriate. Either I'm blind, or the DA 2.0 spec doesn't say enough 
about transactions, automatic or otherwise, for me to know when I 
should begin a new transaction.

Can anyone point to archived discussion that talks about this subject, I 
couldn't find any.

Thanks



Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               ICQ: 14856937