Function DbRUnlock() Foundation

Release record locks in a work area.

DbRUnlock( [<xRecordID>] ) --> NIL
<xRecordID> is an expression clearly identifying a record. It is predetermined by the file format of the data file. For DBF files <xRecordID> is a numeric value designating the record number (RecNo()) of the record whose record lock is to be released. If <xRecordID> is not specified, all existing record locks in the work area are released.

The return value of DbRUnlock() is always NIL.


The database function DbRUnlock() releases existing record locks in a work area. If a record ID <xRecordID> is specified, the record lock is released only for this record. The function DbRUnlock() allows selective releasing of individual locks when multiple data records are locked in a work area. This is not possible with the function DbUnlock(). If no record ID is specified, DbRUnlock() behaves like DbUnlock(), meaning all existing record locks are released. If the function is called without the alias operator, it releases the locks in the current work area. This function is only meaningful when files are open in the SHARED mode.

// The example shows a function which processes an array 
// containing record IDs. The record locks of the data 
// records specified in the array are released. The return 
// value is the return value of DbRLockList(), which is 
// an array containing the records which are still 
// locked. 

FUNCTION UnLockRecords( aRecordID ) 
   LOCAL n, nMax 

   nMax  := Len( aRecordID ) 
   IF nMax == 0 
      DbRUnlock()                    // release all record locks 
      FOR n := 1 TO nMax 
         DbRUnlock( aRecordID[ n ] ) // release individual 
      NEXT                           // record locks 
RETURN DbRLockList()                 // records which are still 
                                     // locked are returned 

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.