Difference between revisions of "LOCKF"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=LOCKF=
 
 
 
==Class==
 
Manual Locking
 
 
 
 
==Purpose==
 
==Purpose==
 
Lock a table for exclusive use
 
Lock a table for exclusive use
Line 15: Line 8:
  
 
==See Also==
 
==See Also==
[[CLEAR LOCKS]], [[CLOSE DATABASES]], [[DISPLAY STATUS]], [[FLOCK()]], [[LOCKR]], [[RLOCK()]], [[SET EXCLUSIVE]], [[UNLOCK]], [[USE]], [[QUIT]]
+
[[CLEAR LOCKS]], [[CLOSE DATABASES]], [[DISPLAY STATUS]], [[FLOCK()]], [[LOCKR]], [[QUIT]], [[RLOCK()]], [[SET EXCLUSIVE]], [[UNLOCK]], [[USE]]
  
  
Line 30: Line 23:
 
seek "OPERA"
 
seek "OPERA"
 
if found()
 
if found()
  lockf
+
    lockf
  replace price with price*1.2
+
    replace price with price * 1.2
  unlock
+
    unlock
 
endif
 
endif
 
</code>
 
</code>
Line 38: Line 31:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Manual Locking]]
 +
[[Category:Manual Locking Commands]]

Latest revision as of 17:16, 11 November 2009

Purpose

Lock a table for exclusive use


Syntax

LOCKF


See Also

CLEAR LOCKS, CLOSE DATABASES, DISPLAY STATUS, FLOCK(), LOCKR, QUIT, RLOCK(), SET EXCLUSIVE, UNLOCK, USE


Description

The LOCKF command provides the facility to lock a table for exclusive use. LOCKF works in a similar way to the FLOCK() function, except that program execution is suspended until the lock is granted. In order to prepare a table for locking, SET EXCLUSIVE OFF must be in effect when you USE the table. If you only want to lock a particular record, then you should use LOCKR rather than LOCKF.

The LOCKF command works in conjunction with the UNLOCK command. Whenever you issue CLOSE DATABASES, UNLOCK, USE, QUIT or CLEAR LOCKS, then any active locks will be removed. You can see any active locks using the DISPLAY STATUS command. This command is not normally used, as the Recital/4GL supports automatic file and record locking.


Example

set exclusive off
use patrons index events, names
seek "OPERA"
if found()
    lockf
    replace price with price * 1.2
    unlock
endif


Products

Recital Server, Recital