[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| FLOCK |
+---------------------------------+
FLOCK([<expN> | <expC>])
-----------------------------------
Attempts to lock database.
Return value - Logical
-----------------------------------
If a file lock is successfully placed, a logical true (.T.) is returned.
If the lock attempt is unsuccessful false (.F.) is returned. You may
use the FLOCK() function from within both the Command window and
programs.
If a file lock is successfully placed on a database, a logical true
(.T.) is returned. The file is now available for both read and write
access by the user who placed the lock. Other users on the network will
have read only access to the database. See the SET EXCLUSIVE or USE
commands for information on how to lock a file and prevent all forms of
access by other users.
A database remains locked until it is unlocked by the user who placed
the lock. The database may be unlocked by issuing the UNLOCK command,
closing the database or QUITting out of FoxPro/LAN. Databases may be
closed with the USE, CLEAR ALL or CLOSE DATABASE commands.
If a record or file lock has already been placed by another user on the
database you are attempting to lock, a logical false (.F.) is returned.
Note that the SET REPROCESS command affects how FLOCK() returns a value.
With SET REPROCESS you may keep attempting to lock a file if the initial
file lock attempt is unsuccessful. For more information about how SET
REPROCESS controls file locking attempts, see the SET REPROCESS topic in
this help facility.
You may establish relations between two or more database files with the
SET RELATION command. Placing a file lock on a database that is related
to one or more databases does not place a file lock on the related
databases. You must explicitly place and remove file locks on the
related databases.
Clauses
-------
<expN> | <expC>
Work area number or alias.
+---------------------------------+
| Program Example |
+---------------------------------+
CLOSE ALL
SET REPROCESS TO 3 SECONDS
USE salesrep
IF FLOCK()
*** Year end sales & commission initialization ***
REPLACE ALL ytdcomm WITH 0.00
REPLACE ALL ytdsales WITH 0.00
WAIT 'Initialization Complete - Press any key' WINDOW NOWAIT
ELSE
*** File is locked, warn user ***
WAIT WINDOW 'Unable to open sales file, try again later!' NOWAIT
ENDIF
-----------------------------------
See Also: LOCK(), RLOCK(), SET REPROCESS, SET RELATION, UNLOCK, USE
-----------------------------------
See Also:
LOCK()
RLOCK()
SET REPROCESS
SET RELATION
UNLOCK
USE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson