Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Release all locks for a work area.

Syntax

UNLOCK    [RECORD nRecordNumber]   [[IN|ALIAS] workarea]   [ALL]

 

Arguments

RECORD nRecordNumberReleases the record lock on record number nRecordNumber. Issuing UNLOCK RECORD nRecordNumber for a record in a table with a file lock releases the file lock.
IN|ALIAS <workarea>Specifies the work area for which the operation must be performed
ALLReleases all record and file locks in all work areas.  If not specified, only the lock in the current work area is released. ALL cannot be combined with the RECORD or IN|ALIAS clause.

Description

UNLOCK is functionally equivalent to DBUnlock() and UNLOCK ALL is functionally equivalent to DBUnlockAll().  

Examples

This example attempts an update operation that requires a record lock.  If the RLock() is successful, the record is updated with a function and the RLock() is released with UNLOCK:

 

USE sales INDEX salesman SHARED NEW
IF RLock()
  UpdateRecord()
  UNLOCK
ELSE
  ? "Record update failed"
  BREAK
ENDIF

Assembly

XSharp.RT.DLL

See Also

DbRLock(), DbUnlock(), DbUnlockAll(), FLock(), RLock(), SetExclusive(), USE