Re: Record Locking
Posted in 1994
> Is there a way I could lock a record to read in a transaction? > Or is this > kind of problem accepatable in Relational world as R1 is a copy and > doesn't guarentee its state in d/b? You have two choices: 1) FETCH the rows through a cursor declared FOR UPDATE. 2) If you have OnLine, raise your isolation level to CURSOR STABILITY by way of the SET ISOLATION statement. The added benefit of (1) is that you can use UPDATE ... WHERE CURRENT OF <cursorname>, which saves 4gl having to re-read the row during the update. However (2) acquires share locks, which you can have as many people acquire on a row at the same time as you want, but (1) acquires a Promotable (or 'Update') lock which only one process can get at once. (1) is both safer and quicker all in all. akent@cix.compulink.co.uk (Andy Kent) ------------------------------------- 44 272 742815