My question is, if i grab a reference to the cursor from some db
connection inside a python
script, and do a bunch of statements directly on this cursor, and
something goes wrong on the nth
statement (i.e. uncaught Exception), should I expect all of the
statements performed using that
cursor up to that point will be automatically rolled back?
Yes.
I would say you may expect automation but ONLY if you have
used Zope machinery to get connection object and if
you've registered ResourceManager in transaction machinery.
It is something like that:
when you call Zope connection object (one visible in ZMI)
it returns instance of ResourceManager (zope.Shared.DC.ZRDB.TM)
that has real connection object as it's attribute (usually 'db').
So you may do something like:
resource_manager = context.OracleDatabaseConnection()
db = resource_manager.db
cur = db.cursor()
etc.
But to commit or rollback automatically you need to call
_register() function of resource_manager.
--
Maciej Wisniowski
_______________________________________________
Zope-DB mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope-db