C5_DBRLOCK

 DBRLOCK()
 Lock the record at the current or specified identity
------------------------------------------------------------------------------
 Syntax

     DBRLOCK([<xIdentity>]) --> lSuccess

 Arguments

     <xIdentity> is a unique value guaranteed by the structure of the
     data file to reference a specific item in a data source (database).  In
     a .dbf <xIdentity> is the record number.  In other data formats,
     <xIdentity> is the unique primary key value.

 Returns

     DBRLOCK() returns lSuccess, a logical data type that is true (.T.) if
     successful, false (.F.) if unsuccessful.

 Description

     DBRLOCK() is a database function that locks the record identified by the
     value <xIdentity>.  In Xbase, <xIdentity> is the record number.

     If you do not specify <xIdentity>, all record locks are released and the
     current record is locked.  If you specify <xIdentity>, DBRLOCK()
     attempts to lock it and, if successful, adds it to the locked record
     list.

 Examples

     .  This example shows two different methods for locking multiple
        records:

     FUNCTION dbRLockRange( nLo, nHi )

              LOCAL nRec
              FOR nRec := nLo TO nHi

                 IF ! DBRLOCK( nRec )
                    DBRUNLOCK()      // Failed - unlock everything
                 ENDIF
              NEXT
           RETURN DBRLOCKLIST()      // Return array of actual locks

        FUNCTION dbRLockArray( aList )

              LOCAL nElement, nLen, lRet
              lRet := .T.
              nLen := LEN( aList )
              FOR nElement := 1 TO nLen
                 IF ! DBRLOCK( aList[ nElement ] )
                    DBRUNLOCK()      // Failed - unlock everything
                    lRet := .F.
                 ENDIF
              NEXT
           RETURN DBRLOCKLIST()

See Also: DBUNLOCK() DBUNLOCKALL() FLOCK() RLOCK() UNLOCK



One response to “C5_DBRLOCK

  1. Pingback: C5DG-3 RDD Reference | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.