xHarbour Reference Documentation > Function Reference |
Locks the current record for concurrent write access in a work area.
RLOCK() --> lIsLocked
The function returns .T. (true) if the current record is successfully locked, otherwise .F. (false) is returned.
The network function RLock() locks the current record in a work area for concurrent write access. If the record is successfully locked, it still can be read by other applications, but it can only be changed by the application which has obtained the record lock.
RLock() releases all pending record locks prior to attempting to lock the current record. If this attempt fails, the record is currently locked by another application in a network.
Record locks are required when a database is opened in SHARED mode and data must be written to the database file using the REPLACE command, or when the deleted flagof the current record is changed using DELETE or RECALL.
After the record is changed, the record lock must be released using UNLOCK or DbUnlock().
See also: | APPEND BLANK, DbRLock(), DbRLockList(), DbUnlock(), DbUseArea(), FLock(), SET EXCLUSIVE, UNLOCK, USE |
Category: | Database functions , Network functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates a typical coding pattern for updating a // record in a networked environment. PROCEDURE Main USE Customer ALIAS Cust SHARED INDEX ON Upper( LastName+FirstName) TO Cust01 SEEK "WALTERS" IF Found() IF RLock() REPLACE FIELD->Lastname WITH "Waters" DbUnlock() ELSE Alert( "Record is currently locked" ) ENDIF ENDIF USE RETURN
http://www.xHarbour.com