RDD

FLock()

Lock the current database file

Syntax

Signature
FLock() --> lSuccess

Arguments

None.

Return value

.T. when the file lock is acquired; otherwise .F..

Description

FLock() asks the active RDD for an exclusive lock on the current database file. It does not move the record pointer or change field data. The lock covers the file rather than one record and remains until the RDD releases it or the work area closes.

Notes

The area must be open in a sharing mode that allows locking. Another user's lock, a read-only area or an I/O failure can make the result false or raise an error. FLock() differs from RLock(), which protects one record only.

Example

Flock.prg
PROCEDURE Main()

   DbUseArea( .T., , "people.dbf", "People" )
   QOut( "File locked: " + IIF( FLock(), "YES", "NO" ) )
   DbCloseArea()

RETURN

Output

See also