Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_dirtyread( [ <lsetting> ] ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_DIRTYREAD( [ <lSetting> ] )

Parameters

<lSetting>
Logical true causes files to be opened with dirtyread On.
Logical false causes files to be opened with dirtyread Off.


Returns

Current setting, as a logical.

Description

Normally, Clipper locks and unlocks the active index file around a 
SEEK, SKIP, or any other command that positions the record pointer. 
This occurs even if a file is opened in read-only mode, in order to 
ensure that no other user is trying to update the index file at the 
exact moment that you are trying to locate a record.

In cases where speed is paramount, it may be best to have the station
forego index file locking. This is what N_DIRTYREAD() does. The function
operates like N_READONLY(), but index files will not be locked around
SKIPs and SEEKs. As a result, speed should increase. Keep in mind,
however, that another user could be updating the index at the exact
moment you are using it.

Calls to N_DIRTYREAD() do not affect currently open files. The access
mode that the function sets applies only to a file opened after
N_DIRTYREAD() is called, and will continue to apply until the file is
closed.

Turn "dirty" access On by calling N_DIRTYREAD(.T.) just before opening
the files where it is needed. Then open the files by issuing a Clipper
USE EXCLUSIVE. The files will not actually be opened in exclusive mode,
but Clipper needs to think that they are in order for the function to
work properly. Once the files are open, call N_DIRTYREAD(.F.) so that
the feature will not be inadvertently set On for any additional files
that your program opens.

Note: Do not attempt to write to a file opened with DIRTYREAD set On.
      The consequence of attempting to update a file opened in this mode
      is unpredictable but probably undesirable.




See Also: N_READONLY() N_USE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson