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.3 . Guide To CA-Clipper - <b>dbrlock()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 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

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