Re: Undocummented: SET ISOLATION TO DIRTY READ
Posted in 1994
In article <2qdouo$513@david.wheaton.edu>, gmribeir@david.wheaton.edu (Glauber Ribeiro) writes:
|> Browsing through some come that i maintain, i found a command
|>
|> SET ISOLATION TO DIRTY READ
|>
|> I couldn't find this in the documentation i have. The command
|> apparently works both from 4GL and ESQLC.
|>
|> Can anybody tell me what this is supposed to do?
|> Also, are there other options or variations for this command?
|>
|> Thank you very much for any help.
|>
SET ISOLATION TO DIRTY READ will fetch data whether or not it has beencommitted and will neither place nor respect locks.
SET ISOLATION TO COMMITTED READ will only fetch data that has been committed
and will fail if the row being fetched is locked.
SET ISOLATION TO CURSOR STABILITY is similar to COMMITTED READ, but places a lock
on the latest row fetched. If used in an ordinary cursor, places a shared lock.If used in an UPDATE cursor, places a promoteable lock.
SET ISOLATION TO REPEATABLE READ will lock each fetched row in the cursor.Similar to CURSOR STABILITY in the types of locks placed. Locks will be released
when the cursor is closed or transaction ends.
In a normal Query/Add/Update program in which a certain amount of concurrency is
desired, it is normal to use Dirty Read in the Query. This will allow you to
at least see the data. If the Query only returns an array of primary keys and
you fetch the actual data only as that row becomes current, the data is
reasonably fresh.
For Update mode, set isolation level to committed read, open an update cursor
and fetch the row. This will fetch the most current, committed data. If
SQLCA.SQLCODE = 0, *you* have the row, if SQLCA.SQLCODE = -246 (or a few
other less common ones) *somebody else* has the row. If you get the row,
you have a lock on it and others attempting the same thing will encounter your
lock.
Haven't used CURSOR STABILITY at all, as it will not ignore locks when I need to
and I can do essentially the same thing with the above.
Have used REPEATABLE READ when I want to be able to lock all of the rows in a
cursor, allowing any or all of them to be updated by the user and then committed
to the database without any of them being updateable by anyone else.
Hope this helps,
DCT