[Zope] SQL-Transaction

Dieter Maurer dieter@handshake.de
Thu, 29 May 2003 21:04:41 +0200


Dieter Fischer wrote at 2003-5-29 15:02 +0200:
 > I've something like:
 > 
 >    <dtml-call "insert(REQUEST)">
 >    <dtml-call "RESPONSE.redirect(REQUEST['myform'])">
 > 
 > In the myform I'd like to show the values I've inserted with a ZSQL-Method.
 > This form uses also a ZSQL-Method, to show the data inserted before. The
 > problem is, that sometimes the values are not shown in the form. When I
 > reload the page, the values are there.
 > 
 > How do I asure, that the transaction is made to the db, before I show the
 > form?

This should be the case, unless your database system behaves
unexpectedly.

  At the end of the request, Zope calls a "commit" for the affected
  databases.
  When such a "commit" only returns when the transaction
  is committed (in my view, this is required to be compliant
  with the serializability isolation level), then the
  "redirect" will see the committed data because Zope
  sends the response (with the "redirect") only after the
  "commit" returns.

We have recently seen several case, where "commit"s were lost.
In our case, this was due to bugs in some of our products that
registered the DA's too late with the transaction.
Maybe, one of the products you use has a similar problem?


Dieter