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

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

Dario Lopez-K=E4sten wrote:

>I am almost finished porting one of my plsql apps to zope and I have
>stumbled upon a transaction/lock thingie that I need help in sorting out.
>Here's the example:
>I have a table of items. Each item has a name, a column for max items an=
d a
>column for booked items.
>The column for booked items is updated by several people att the same ti=
>The process goes like this:
>1 - check if there are any items left to book
>2 - book the item
>in between 1 and 2 there is the possiblity of someone else booking an it=
>So the question is, how does zope keep locks in the transaction? What is=
>transaction in the Zope sense?
>Nayhelp appreciated.

If you use SELECT ... FOR UPDATE you will lock the columns you select so=20
they cannot be updated by another query until your transaction commits=20
(ie it should be pessimistic locking, vs Oracle's normal optimistic=20
locking strategy).