[Zope-DB] Concurrenct updates in a table, column, row

Matthew T. Kromer matt@zope.com
Wed, 12 Dec 2001 11:27:43 -0500


Dario Lopez-K=E4sten wrote:

>>If you use SELECT ... FOR UPDATE you will lock the columns you select s=
o
>>they cannot be updated by another query until your transaction commits
>>(ie it should be pessimistic locking, vs Oracle's normal optimistic
>>locking strategy).
>>
>
>thanks, matt - got a followup question:
>
>if I am in the same request, and I do this i zsqlmeth1 and then do the
>actual update in zsqlmeth2 and do the commit in zsqlmeth3, all using the
>same db-connection object, will it work?
>
>I am calling them from the same PythonScript? How do I know if I am stil=
l in
>the same transcation?
>
>/dario
>
>

You're in the same transaction in Zope if you've never tried to do an=20
explicit COMMIT (dont!) and you're still in the same REQUEST that you=20
were before.  The Zope machinery will call COMMIT or ROLLBACK for you=20
when the HTTP request is complete or if it bombs and needs to be restarte=
d.