>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