Function DbUnlock() Foundation

Releases record and file locks in a work area.

Syntax
DbUnlock() --> NIL
Return

The return value of DbUnlock() is always NIL.

Description

The database function DbUnlock() removes all existing record and file locks in a work area. When the function is used without the alias operator, it releases the locks in the current work area. The function is only meaningful when files are open in SHARED mode.

The command UNLOCK can be used instead of DbUnlock(). UNLOCK is effective only in the current work area.

Examples
DbUnlock()
// In the example, a record is locked before it is 
// marked as deleted. If the record could be locked, 
// the record lock is released after the deletion. 

PROCEDURE Main 
   USE Customer ALIAS Cust NEW SHARED 
   GOTO 10 

   IF Cust->( RLock() ) 
      Cust->( DbDelete() ) 
      ? "Record No 10 is deleted" 
      Cust->( DbUnlock() ) 
   ELSE 
      ? "Record No 10 cannot be locked" 
   ENDIF 

   CLOSE Cust 
RETURN 

Feedback

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.