[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|              RLOCK              |
+---------------------------------+
RLOCK([<expN1> | <expC1>]
        | [<expC2>, <expN2> | <expC3>])

-----------------------------------
Attempts to lock database record or records.
Return value - Logical
-----------------------------------

With RLOCK(), you may attempt to place a lock on a database record or a
set of records.  FoxPro/LAN, the network version of FoxPro, is required
to lock database records or files.

If the lock or locks are successfully placed, a logical true value (.T.)
is returned.  Locked records are available for both read and write
access to the user who placed the locks - read-only access to the
records is available to all other users on the network.  RLOCK() always
returns true in the single-user version of FoxPro.

Executing RLOCK() does not guarantee that the attempted record lock or
locks will be successfully placed.  A record lock cannot be placed on a
record already locked by another user, or on a record in a database file
locked by another user.  If the record lock or locks cannot be placed
for any reason, a false (.F.) is returned.

You can issue RLOCK() from the Command window and programs.  RLOCK() is
identical to LOCK().

SET REPROCESS affects how RLOCK() returns a value.  With SET REPROCESS
you may keep continue attempting to lock a record if the initial lock
attempt is unsuccessful.  For more information about how SET REPROCESS
controls record locking attempts, see the SET REPROCESS topic in this
help facility.

SET MULTILOCKS determines whether you may lock multiple records in a
database.  If MULTILOCKS is SET OFF (the default), you may only lock a
single record in a database.  Multiple records in a database may be
locked when MULTILOCKS is SET ON.  See SET MULTILOCKS in this help
facility for further information.

Clauses
-------

<expN> | <expC1>
        If you don't specify a work area or alias, RLOCK() attempts to lock the
current record in the database file in the currently selected work area.

        To attempt a record lock on the current record in a database open in
another work area, include the work area number <expN>, or the database
alias <expC1>.

<expC2>
        To lock multiple records, include <expC2>.  You must also include the
work area or alias of the database in which you attempt multiple record
locks, and MULTILOCKS must be SET ON.

        <expC2> is a list of one or more record numbers.  RLOCK() attempts to
lock all of these records.  The record numbers in <expC2> must be
separated by commas.  For example, to attempt record locks on the first
four records in a database, <expC2> would contain '1,2,3,4'.

        You may also lock multiple records by moving the record pointer to the
record you would like to lock, issuing RLOCK() or LOCK(), and then
repeating this for each record you want to lock.

        If all records specified in <expC2> are successfully locked, true (.T.)
is returned.

        If just one of the records specified in <expC2> cannot be locked, false
(.F.) is returned and none of the records will be locked.  However, any
existing record locks will remain in place.  Multiple record locking is
an additive process - placing additional record locks does not release
locks on other records.

        The maximum number of records that may be locked in each work area is
approximately 8,000.

Unlocking Records
-----------------

        A database record may only be unlocked by the user who placed the lock.
Record locks may be released by issuing UNLOCK , closing the database or
quitting FoxPro/LAN.

        UNLOCK may be used to release record locks in the current work area
(UNLOCK), a specific work area (UNLOCK IN <expN> | expC1>) or in all
work areas (UNLOCK ALL).  See UNLOCK in this help facility for more
information on its use and syntax.

        Toggling MULTILOCKS from ON to OFF or from OFF to ON implicitly
performs an UNLOCK ALL - all record locks in all work areas are
released.

        Databases may be closed with the USE, CLEAR ALL or CLOSE DATABASE
commands.

+---------------------------------+
|         Program Example         |
+---------------------------------+
SET MULTILOCKS ON
SET REPROCESS TO AUTOMATIC
STORE '1,2,3,4' TO mreclist

USE customer IN A
USE states   IN B

? LOCK('1,2,3,4', 'A')  && Lock the first 4 records in customer
? RLOCK('1,2,3,4', 2)           && Lock the first 4 records in states
UNLOCK IN customer
UNLOCK IN states

? LOCK(mreclist, 1)             && Lock the first 4 records in customer
? RLOCK(mreclist, 'B')  && Lock the first 4 records in states
UNLOCK IN customer
UNLOCK IN states

-----------------------------------

See Also:  CLEAR, CLOSE, FLOCK(), LOCK(), SET MULTILOCKS, SET REPROCESS,
SET RELATION, UNLOCK, USE

-----------------------------------

See Also: CLEAR CLOSE FLOCK() LOCK() SET MULTILOCKS SET REPROCESS
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson