Functions.SetExclusive Method (Logic)
Return and optionally change the setting that determines whether to open database files in exclusive or shared mode.
XSharp.Core (in XSharp.Core.dll) Version: 2.16
Syntax Request Example
lNewSetting AS LOGIC
) AS LOGIC
public static bool SetExclusive(
- Type: Logic
TRUE causes database files to be opened in exclusive (nonshared) mode; FALSE causes database files to be opened in shared mode.
The initial default is TRUE.
is not specified, SetExclusive() returns the current setting.
is specified, the previous setting is returned.
SetExclusive() determines whether a USE command specified without the EXCLUSIVE or SHARED clause automatically opens database, memo, and index files as EXCLUSIVE. When database files are opened as EXCLUSIVE, other users cannot use them until they are closed. In this mode, file and record locks are unnecessary.
When TRUE is specified, all database and associated files open in a nonshared (exclusive) mode unless the USE command is specified with the SHARED clause.
Use this only for operations that absolutely require exclusive use of a database file, such as PACK, REINDEX, and ZAP.
When FALSE is specified, all files are open in shared mode unless the USE command is specified with the EXCLUSIVE clause.
Do not use SetExclusive() to control access by other users to records and files. You can control access programmatically using RLock() and FLock().
SetExclusive() is a compatibility function and not recommended.
It is superseded by the EXCLUSIVE and SHARED clauses of the USE command.
Attempting to use a database file already opened as exclusive by another user generates a runtime error and sets NetErr() to TRUE.
After control returns to the point of error, you can test NetErr() to determine whether the USE command failed.
Examples See Also