[Zope-DB] How to use commit/rollback etc. with Zope + ZpsycopgDA ???
Emmanuel Courcelle
emmanuel.courcelle@toulouse.inra.fr
Mon, 25 Mar 2002 15:44:06 +0100
Hello.
I am currently developping an user interface towards a postgresql
database,
using Zope + ZpsycopgDA.
Here is my pb:
I have a python external script, with some code like:
#####
context.zsql_some_zsql_method(...)
for i in some_list:
context.zsql_some_other_zsql_method(...)
#####
The pb is that if one of the context.zsql_some_other_method(...) gets
an error,
the database is inconsistent. This could be solved using only ONE
transaction,
BUT the Zope zsql methods are wrapped inside a transaction, so that
I have a transaction for EACH zsql call.=20
I would prefer ONE transaction for the WHOLE process.=20
I cannot insert all the sql code inside the same zsql method, because as
fas a I know
it is not possible implementing for loops inside a zsql method.
So, what is the solution ???
Thanks in advance,
--=20
Emmanuel COURCELLE emmanuel.courcelle@toulouse.inra.fr
L.B.M.R.P.M. (C.N.R.S.-I.N.R.A.) tel (33) 5-61-28-54-50
B.P.27 - 31326 CASTANET TOLOSAN Cedex
------
S'ils te demandent de te taire, d'attendre, de patienter encore
N'=E9coute que ton =E2me et agis. Djur Djura