[DB-SIG] oracledb commit behaviour

Paul Boddie Paul Boddie <Paul.Boddie@cern.ch>
Fri, 19 Jun 1998 13:46:57 +0200 (MET DST)


Hello,

I think that I have uncovered some strange behaviour with oracledb-0.1.3 and 
exception handling. I have a few scripts where the following type of thing is 
done:

cursor = connection.cursor()

for i in something:	
	try:
		<do something which might cause an exception here>
		cursor.execute(...)
	except SomeException:
		...
	
cursor.close()

print "The end."
connection.commit()
connection.close()

The problem is that if an unhandled exception occurs, a commit still seems to 
get done! For example, I can pass around the loop once, and one execute gets 
done, but then on the second pass an exception (other than SomeException) 
occurs, but although the message "The end." never gets printed, the commit still 
seems to take place. This is most alarming. Has anyone seen anything like this 
before?

I'm using oracledb-0.1.3 (with patches only to add some other, unused features 
in this case), Oracle 7.3.3 and Python 1.5.1. I have also tried the same thing 
with an unpatched version of oracledb-0.1.3, and an unpatched version compiled 
using older Oracle 7.1 libraries (albeit for Python 1.4).

The only thing that I can see is that ologof is being called when the connection 
is destructed. If this is the case, then it may be that a commit is being done 
implicitly (see 2-27, Oracle Call Interface Release 7.3 Programmer's Guide).

Any ideas, suggestions, analogous situations?

Paul Boddie			Paul.Boddie@cern.ch
| http://assuwww.cern.ch/~pboddie
| Any views expressed above are personal and not necessarily
| shared by my employer or my associates.