[About The Guide]
Lock the current record in the active work area
RLOCK() --> lSuccess
RLOCK() returns true (.T.) if the record lock is obtained; otherwise, it
returns false (.F.).
RLOCK() is a network function that locks the current record, preventing
other users from updating the record until the lock is released.
RLOCK() provides a shared lock, allowing other users read-only access to
the locked record while allowing only the current user to modify it. A
record lock remains until another record is locked, an UNLOCK is
executed, the current database file is closed, or an FLOCK() is obtained
on the current database file.
For each invocation of RLOCK(), there is one attempt to lock the current
record, and the result is returned as a logical value. An attempt to
obtain a record lock fails if another user currently has a file or
record lock on that particular record, or EXCLUSIVE USE of the database
file. An attempt to RLOCK() in an empty database returns true (.T.).
By default, RLOCK() operates on the currently selected work area. It
will operate on an unselected work area if you specify it as part of an
aliased expression (see example below). This feature is useful since
RLOCK() does not automatically attempt a record lock for related files.
As a general rule, RLOCK() operates solely on the current record. This
includes the following commands:
. DELETE (single record)
. RECALL (single record)
. REPLACE (single record)
Refer to the "Network Programming" chapter in the Programming and
Utilities Guide for more information.
. SET RELATION: CA-Clipper does not automatically lock all
records in the relation chain when you lock the current work area
record. Also, an UNLOCK has no effect on related work areas.
. This example deletes a record in a network environment, using
USE Customer INDEX CustName SHARED NEW
? "Smith deleted"
? "Record in use by another"
? "Smith not in Customer file"
. This example specifies RLOCK() as an aliased expression to
lock a record in an unselected work area:
USE Sales SHARED NEW
USE Customer SHARED NEW
? "The current Sales record is in use by another"
Files Library is CLIPPER.LIB.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson