Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC in pessimistic mode
Message
From
03/11/1997 17:23:11
 
 
To
03/11/1997 15:57:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00057793
Message ID:
00058058
Views:
28
>Ok, this is the technique we are focusing on. But, there is a problem with that. How can we be sure that 2 persons won't attempt to lock it at the same time? This is where a RLOCK() similar way of doing things is needed. Also, in our case, we will have different backends. In addition to finding a secure way of making sure not 2 persons get the record at the same time, we also need a mecanism that will work for all.
>
>Thanks.

If the lock column is called lock_user and it will accept NULLs than use a SQL UPDATE that looks something like this:

UPDATE table
SET lock_user = id
WHERE pk_column = pk_value
AND lock_user IS NULL

Only one person will be able to hit the row (or page depending on the database).

Then check the effected-row count or check the lock_user column to see if you got the lock.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform