Bypassing Automatic Record Locking with READ NOLOCK

ID: Q95746

2.00 2.50 2.50a | 2.50 2.50a

MS-DOS          | WINDOWS
kbprg

The information in this article applies to:

SUMMARY

FoxPro automatically locks the record in the currently selected database as well as any related records in other work areas that are involved in a READ command. You can bypass the automatic record locking by using the READ NOLOCK command. Using this command may result in improved network performance when you are skipping through a database file.

MORE INFORMATION

Issuing a READ NOLOCK command bypasses automatic record locking. The record is displayed and the GET fields are enabled, but are read-only. Any controls, such as buttons, that use a field are disabled and cannot be chosen.

The record cannot be edited until SHOW GETS LOCK, LOCK(), or RLOCK() is issued. The record cannot be locked by using the shortcut key combination CTRL+O.

Issuing SHOW GETS without the LOCK clause will not allow the record to be locked, because SHOW GETS assumes the locking behavior of the READ command itself. Since the READ command has the NOLOCK clause, SHOW GETS will not lock the record.

SHOW GETS LOCK, LOCK(), and RLOCK() all attempt to lock the record in the current work area. SHOW GETS LOCK attempts to lock related records in other work areas as well. LOCK() and RLOCK() do not attempt to lock related records. If the record is locked by another user, FoxPro will return error 109.

If SET MULTILOCKS is OFF, the record lock will automatically be released when the record pointer is moved off the current record. If SET MULTILOCKS is ON, the record lock will not be released until the database is closed, the user exits FoxPro, or an UNLOCK command is issued.

To enable READ NOLOCK, SET EXCLUSIVE must be OFF.

To issue a READ NOLOCK command for a screen created through the FoxPro screen generator, check the READ NOLOCK check box in the generator options dialog box.

REFERENCES

"Commands & Functions," READ, SHOW GETS, LOCK(), RLOCK(), SET MULTILOCKS, SET EXCLUSIVE

"Developer's Guide," Multi-User section

Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a multiuser KBCategory: kbprg KBSubcategory: FxprgMultiuser

Keywords          : FxprgMultiuser 
Version           : 2.00 2.50 2.50a | 2.50 2.50a
Platform          : MS-DOS WINDOWS

Last Reviewed: April 30, 1996