Returns and sets the AXS locking status
Syntax
AX_AXSLocking( [.T.|.F.] ) -> logical
[.T.|.F.] A logical value used to turn AXS Locking ON (.T.) or OFF (.F.).
Returns
If no parameter is passed to AX_AXSLocking(), then returns the current Advantage Locking setting (i.e. returns a .T. if AXS Locking is ON or .F. if AXS Locking is turned OFF). If a parameter is passed to AX_AXSLocking(), then returns previous Advantage Locking setting.
Description
AX_AXSLocking() will turn Advantage Locking ON if the logical value .T. is passed in or turn Advantage Locking OFF if the logical value .F. is passed in. If no value is passed in, the current setting of Advantage Locking is returned, and Advantage Locking remains the same.
The current setting is always returned first before being set to ON/OFF.
AX_AXSLocking()allows you to alter lock management calls. Record and file locking is essential to prevent corruption in a shared environment. In previous versions of Advantage, the locking was managed strictly by Advantage, using proprietary locking schemes. This also required any other applications using the shared files to be Advantage applications. Once AXS Locking is set ON or OFF, it applies to all subsequent work areas opened in the application.
For considerations when using this function, see Advantage Locking Modes.
Object-oriented Example
See CLASS AxDBServer for code sample for the AxDBServer class.
// Set the global flag so that Advantage Locking is OFF. |
// (Non-Advantage applications can have access.) |
AX_AXSLocking( .F. ) |
|
oDB1 := AxDBServer{ "TEST1", .F., .F., "DBFNTXAX" } |
|
// Set the global flag so that Advantage Locking is ON. |
AX_AXSLocking( .T. ) |
|
oDB2 := AxDBServer{ "TEST2", .F., .F., "DBFNTXAX" } |
|
Procedural Example
? "AXS locking is currently," AX_AXSLocking() |
|
// Turn AXS locking OFF so this workarea will see Visual Objects’ |
// DBFNTX locking |
|
AX_AXSLocking( .F. ) |
|
USE test VIA "DBFNTXAX" SHARED NEW |
|
// This lock will be seen by Visual Objects and will respect |
// Visual Objects’ locks |
|
? Rlock() |