Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> LOCKING

LOCKING

From: Don Fraser <don_at_clear.net.nz>
Date: 1997/11/06
Message-ID: <63s2il$337@granny.mac.co.nz>#1/1

This may be of interest as a method of handling locking;

Add an integer column to each entity table eg entity_name_lock. read rows to user form and include the lock column, to update;
begin transaction
rows updated = update tablename
set your new values and lock = lock + 1
where your restrictions and lock column = readvalue of lock column update any children
If rows update > 0 then commit else rollback, warn user, reload the changed record.

Any successfull update sinse the row was read will have increased the lock value.

The advantages are no other table involved so no performance dissadvantages. No lock of read rows held by user.
The lock column records the number of successfull updates on a row. There is usually (often) a business problem if two users are attempting to update the same row.

The dissadvantage of loosing the user changes may be over come by some creative code to reload only the changes made by the other user and offering this user the possibility of saving again.

Don Fraser
Aotea Software
Aotearoa (NZ) Received on Thu Nov 06 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US