Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET EXCLUSIVE, Set(“Exclusive”)

This command determines whether the default mode for opening tables is exclusive or shared access.

Usage

SET EXCLUSIVE ON | OFF
cIsItExclusive = SET( "EXCLUSIVE" )

Parameter

Value

Meaning

cIsItExclusive

"ON"

Unless otherwise specified, open tables exclusive.

"OFF"

Unless otherwise specified, open tables shared.

Opening a table for exclusive access makes it totally unavailable to other users, even to other applications on the same machine or other forms with private data sessions in the same application. You can’t even read the data for reporting or queries. So you only want to do it when you have to—such as when you need to perform maintenance that requires exclusive access. (For example, you need exclusive access to rebuild indexes, change table structures, and so on.)

EXCLUSIVE can improve system performance tremendously, and should be considered for single-user applications running in a non-networked environment.

EXCLUSIVE can be set differently for each data session. By default, it’s ON for the global, default data session, and OFF for all private data sessions.

The current SET EXCLUSIVE setting is used for all kinds of operations that open tables, including SELECT-SQL, CREATE, INSERT INTO, and any other command that opens a table to do its work. The only way to override the current setting is to open the table with USE and add either the SHARED or EXCLUSIVE keyword. SET EXCLUSIVE also affects opening databases with OPEN DATABASE or MODIFY DATABASE. Again, you can override the default in the OPEN DATABASE command.

SET(“EXCLUSIVE”) tells you the current setting.

Example

SET EXCLUSIVE ON
USE Employee
INDEX ON UPPER(Last_Name+First_Name) TAG Name

See Also

FLock(), IsExclusive(), Modify Database, Open Database, RLock(), Use