Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>rlock()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 RLOCK()
 Lock the current record in the active work area
------------------------------------------------------------------------------
 Syntax

     RLOCK() --> lSuccess

 Returns

     RLOCK() returns true (.T.) if the record lock is obtained; otherwise, it
     returns false (.F.).

 Description

     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, 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:

     .  @...GET

     .  DELETE (single record)

     .  RECALL (single record)

     .  REPLACE (single record)

     Refer to the Network Programming chapter in the Programming and
     Utilities guide for more information.

 Notes

     .  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.

 Examples

     .  This example deletes a record in a network environment, using
        RLOCK():

        USE Customer INDEX CustName SHARED NEW
        SEEK "Smith"
        IF FOUND()
           IF RLOCK()
              DELETE
              ? "Smith deleted"
           ELSE
              ? "Record in use by another"
           ENDIF
        ELSE
           ? "Smith not in Customer file"
        ENDIF
        CLOSE

     .  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
        //
        IF !Sales->(RLOCK())
           ? "The current Sales record is in use by another"
        ENDIF

 Files:  Library is CLIPPER.LIB.

See Also: APPEND BLANK FLOCK() SET EXCLUSIVE* UNLOCK USE

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