[Zope-DB] Transaction again..
Dieter Maurer
dieter at handshake.de
Fri Oct 3 16:53:44 EDT 2003
Gál László wrote at 2003-10-3 13:34 +0200:
> I still have some things that I don't understand:
>
> Let's take an example:
>
> next_id=container.next_id()[0]
> #1
> container.insert_details1(fg_key=id)
> #2
> container.insert_details2(fg_key=id)
>
> It is OK, that if any error occurs in the script, zope rolls back each of the zsql methods,
> but who garantees that the postges db don't change in #1 or #2.
> If it is changed by an other insert for example, id is wrong.
Then, you should let Postgres generate the id.
A so called "sequence" (a Postgres object type) is the way to go...
Dieter
More information about the Zope-DB
mailing list