Hi Folks,
How to lock down a DB record instead of theentire DB table to prevent concurrent update to the data ?
Previously, i use the progress version 9.1B there are allow to lock down the entire DB table.
Any advise?
Thank you!
E.g select * from tblUser , it will lock the entire table.
select * from tblUser where userID = "abc".
How to lock the only this record instead of the entire table ?
You are doing this in SQL rather than ABL?
in ABL, how to go about it to lock only the individual record?
Thanks.
In ABL, you can use SHARE-LOCK or EXCLUSIVE-LOCK for this purpose. Please refer to the documentation of these options.
In ABL, you can't do anything other than lock an individual record ... with one exception. I don't know if this is still true, but it used to be the case that if you did a FOR EACH EXCLUSIVE-LOCK with a WHERE clause that eliminated large numbers of records, it would lock all the records it skipped while it looked for one that qualified. This was ***many*** years ago and I never see it any more since I would always do the outer loop no-lock and then reread the selected record exclusive lock.
I suspect there must be something behind this question that you haven't told us, so perhaps it would help if you explained a bit more.
also, there is no UNLOCK statement. Locks are managed internally by the 4GL compiler, 4GL runtime, and the database based on things like buffer scope and transaction boundaries which are used to determine the duration of row-level locks.
in SQL, locks are managed by the OpenEdge SQL Server's query engine, primarily based on the isolation level in effect and transaction duration.