Thread: check if table/object is locked

check if table/object is locked

From
Jonathan Weiss
Date:
hi!


i have a problem. i developed an application for administrating cliet and
their sales. if i want to edit a client i load him by select for update. now if
another person want to update him, the query waits, until the first
connection is closed. this is unacceptable, because the whole application is doing
nothing until the db is responding. how can i check if the client is locked
before i want to load him?

thanks,


Jonathan Weiss

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!



Re: check if table/object is locked

From
Rod Taylor
Date:
Simple answer is don't lock it like that.

Store a 'last changed' date that you update when you change the tuple.
Confirm prior to writing that the 'last change' date hasn't changed
since you pulled out the information to display to the user (yes, do the
for update lock during this much shorter time).

On Sun, 2003-03-09 at 10:14, Jonathan Weiss wrote:
> hi!
>
>
> i have a problem. i developed an application for administrating cliet and
> their sales. if i want to edit a client i load him by select for update. now if
> another person want to update him, the query waits, until the first
> connection is closed. this is unacceptable, because the whole application is doing
> nothing until the db is responding. how can i check if the client is locked
> before i want to load him?
>
> thanks,
>
>
> Jonathan Weiss
--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc