Release file/record locks set by the current user
ALL releases all current locks in all work areas. If not specified, only the lock in the current work area is released.
UNLOCK is a network command that releases file or record locks set by the current user. Use it when you want to release the current lock without setting a new lock. Both FLOCK() and RLOCK() release the current lock before setting a new one.
After an UNLOCK, an update to a shared database file and associated index and memo files becomes visible to DOS and other applications, but is not guaranteed to appear on disk until you perform a COMMIT or close the file.
Refer to the “Network Programming” chapter in the Programming and Utilities Guide for more information on the principles of locking and update visibility.
. SET RELATION: UNLOCK does not automatically release a record lock along a RELATION chain unless you UNLOCK ALL.
. This example attempts an update operation that requires a
record lock. If the RLOCK() is successful, the record is updated
with a user-defined function and the RLOCK() is released with UNLOCK:
USE Sales INDEX Salesman SHARED NEW
? "Record update failed"
DBUNLOCK(), DBUNLOCKALL(), FLOCK(), RLOCK(), SET RELATION
Unlock a record or release a file lock
This function releases the file or record lock in the currently selected or aliased work area. It will not unlock an associated lock in a related databases.
nId := 10
USE testid INDEX testid NEW
IF testid->( DBSEEK( nId ) )
IF testid->( RLOCK() )
Library is rdd
DBUNLOCKALL(), FLOCK(), RLOCK()
This function locks the record based on identity
DBRLOCK([<xIdentity>]) --> lSuccess
<xIdentity> Record identifier
DBRLOCK() returns a logical true (.T.) if lock was successful
This function attempts to lock a record which is identified by <xIdentity> in the active data set. If the lock is successful the function will return a logical true (.T.) value; otherwise a logical false (.F.) will be returned. If <xIdentity> is not passed it will be assumed to lock the current active record/data item.
LOCAL x := 0
USE tests NEW
FOR x := 1 TO reccount()
IF ! DBRLOCK()
Library is rdd
DBUNLOCK(), DBUNLOCKALL(), FLOCK(), RLOCK()
Appends a new record to a database file.
DbAppend( [<lLock>] ) --> NIL
<lLock> Toggle to release record locks
DbAppend() always returns NIL
This function add a new record to the end of the database in the selected or aliased work area. All fields in that database will be given empty data values – character fields will be filled with blank spaces, date fields with CTOD(‘//’), numeric fields with 0, logical fields with .F., and memo fields with NULL bytes. The header of the database is not updated until the record is flushed from the buffer and the contents are written to the disk.
Under a networking enviroment, DBAPPEND() performs an additional operation: It attrmps to lock the newly added record. If the database file is currently locked or if a locking assignment if made to LASTREC()+1, NETERR() will return a logical true (.T.) immediately after the DBAPPEND() function. This function does not unlock the locked records.
If <lLock> is passed a logical true (.T.) value, it will release the record locks, which allows the application to main- tain multiple record locks during an appending operation. The default for this parameter is a logical false (.F.).
LOCAL cName := "HARBOUR", nId := 10
test->( dbAppend() )
REPLACE test->Name WITH cName, test->Id WITH nId
Library is rdd
Release all locks for all work areas
DBUNLOCKALL() --> NIL
DBUNLOCKALL() always returns NIL.
DBUNLOCKALL() releases any record or file locks obtained by the current
process for any work area. DBUNLOCKALL() is only meaningful on a shared
database in a network environment. It is equivalent to calling
DBUNLOCK() on every occupied work area.
DBUNLOCKALL() performs the same function as the UNLOCK ALL command. For
more information, refer to the UNLOCK ALL command.
. The following example marks a record for deletion if an
RLOCK() attempt is successful, then clears all locks in all work
cLast := "Winston"
USE Sales SHARED NEW VIA "DBFNTX"
DBSETINDEX( "SALEFNAM" )
DBSETINDEX( "SALELNAM" )
USE Colls SHARED NEW VIA "DBFNTX"
DBSETINDEX( "COLLFNAM" )
DBSETINDEX( "COLLLNAM" )
DBSELECTAREA( "Sales" ) // select "Sales" work area
IF ( Colls->(DBSEEK(cLast)) )
IF Colls->( DELETED() )
? "Record deleted: ", Colls->( DELETED() )
IF Colls->( RLOCK() )
Colls->( DBRECALL() )
? "Record recalled..."
? "Not found"
DBUNLOCKALL() // remove all locks in
ENDIF // all work areas
Files Library is CLIPPER.LIB.
See Also: DBUNLOCK() FLOCK() RLOCK() UNLOCK
Release all locks for the current workarea
DBUNLOCK() --> NIL
Release all locks for all workareas
DBUNLOCKALL() --> NIL
Lock an open and shared database file
FLOCK() --> lSuccess
Determine if a network command has failed
NETERR([<lNewError>]) --> lError
Return the current workstation identification
NETNAME() --> cWorkstationName
Lock the current record in the active work area
RLOCK() --> lSuccess
Establish shared or exclusive USE of database files
SET EXCLUSIVE ON | off | <xlToggle>
Release file record locks set by the current user