ISEXCLUSIVE( ) Function
Returns true (.T.) if a table or database is opened for exclusive use; otherwise, returns false (.F.).
ISEXCLUSIVE([cTableAlias | nWorkArea | cDatabaseName [, nType]])
Return Values
Logical
Parameters
cTableAlias
Specifies the alias of the table for which the exclusive use status is returned. Visual FoxPro generates an error message if you specify a table alias that doesn't exist.nWorkArea
Specifies the work area of the table for which the exclusive use status is returned. ISEXCLUSIVE( ) returns false (.F.) if a table isn't open in the work area you specify.cDatabaseName
Specifies the name of the database for which the exclusive use status is returned.nType
Specifies whether the exclusive status is returned for a table or a database. The following table lists the values for nType and the corresponding status returned.nType Exclusive Status Returned 1 Table 2 Database To determine the exclusive status for a database, you must include nType with a value of 2.
Remarks
ISEXCLUSIVE( ) returns a value for the table open in the currently selected work area if you omit the optional cTableAlias, nWorkArea, or cDatabaseName arguments.
A table is opened for exclusive use by including the EXCLUSIVE keyword in USE, or by setting SET EXCLUSIVE to ON before the table is opened.
A database is opened for exclusive use by including the EXCLUSIVE keyword in OPEN DATABASE.
Example
In the following example, the ISEXCLUSIVE( ) function verifies that the table was opened for exclusive use. The table is not reindexed since the one in the current work are was not opened for exclusive use.
cExclusive = SET('EXCLUSIVE')
SET EXCLUSIVE OFF
SET PATH TO (HOME(2) + 'data\')
OPEN DATA testdata && Opens the test databsase
USE customer && Not opened exclusively
USE employee IN 0 EXCLUSIVE && Opened exclusively in another work area
IF ISEXCLUSIVE( )
REINDEX && Can only be done if table opened exclusively
ELSE
WAIT WINDOW 'The table has to be exclusively opened'
ENDIF
SET EXCLUSIVE &cExclusive