xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

NetFileLock()

Applies a file lock to an open, shared database.

Syntax

NetFileLock( [<nSeconds>] ) --> lSuccess

Arguments

<nSeconds>
Optionally, a numeric value can be passed specifying the amount of seconds to retry the operation before the function returns without success. It defaults to the return value of SetNetDelay().

Return

The function returns .T. (true) when the current database file is successfully locked, otherwise .F. (false) is returned.

Description

NetFileLock() is a network function used to obtain a lock on the database file open in shared mode for multi-user access. If the database file cannot be locked due to the file being used by another process, the function retries the operation for a maximum of <nSeconds> seconds and prompts the user if the operation should be retried or aborted.

The function uses FLock() and implements additional default logic for database locking in a network when the database cannot be locked at the moment. Refer to FLock() for more information on locking a database file.

Note:  call function DbUnlock() to release the file lock after data is written to the database file.

Info

See also:DbRLock(), DbUnlock(), DbUnlockAll(), DbUseArea(), FLock(), RLock(), SET EXCLUSIVE, UNLOCK, USE
Category: Database functions , Network functions , xHarbour extensions
Source:rtl\ttable.prg
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe