Unlock
Unlock allows to unlock either a symbol or all the tables previously locked by the development partner.
Syntax
(1) Unlock CLASS_LIST
(2) Unlock SYMBOL_LIST
CLASS_LISTis a list ofCLASSESseparated by commas that correspond to opened tables.SYMBOL_LISTis a list ofSYMBOLSseparated by commas that correspond to locked symbols.CLASSis an abbreviation between square brackets with the syntax[ABBR]or[F:ABBR].SYMBOLcan have one of the following syntaxes:SYMBSYMBFrom FOLDERSYMBFrom "SERVER@FOLDER"- =
EXPRESSION - =
EXPRESSIONFromFOLDER - =
EXPRESSIONFrom "SERVER@FOLDER"
SERVERis the name of a SAFE X3 server.FOLDERis the name of a folder (by default, the current folder is used).EXPRESSIONis an alphanumeric expression that returns the name of the symbol to be unlocked.SYMBis the symbol name (starts with an upper case letter, can include other upper case letters, digits, and underscores).
Examples
# Let's free the symbol SYMBOL that was previously locked
Unlock SYMBOL
# Let's free a record previously locked
Readlock [TEST]CLE2(1) = date$
If [S]fstat
[TEST]ZONE += 100
Rewrite [TEST]
Unlock [TEST]
Endif
# Let's unlock a computed symbol
SYMBOL = "MYLOCK"
Lock =SYMBOL With lockwait = 0
...
Unlock =SYMBOL
Description
Unlock unlocks:
- A table locked by Lock.
- A symbol locked by Lock.
- All the records locked on a table by Readlock or by ForWithLock loop.
Unlock does not update the fstat variable.
Unlock works on tables only if no transaction was created by Trbegin. In a transaction, Unlock does not work (the Commit or Rollback will release the locks).
Comments
A lock on a table is automatically released when the table is closed. This means that a Close, as well as a LogicClose done on a LocalFile will implicitly unlock the table and its lines.
In a transaction, the updated lines are automatically locked and unlocked upon transaction end (by Commit or Rollback). The symbols are not concerned by this automatic release of locks.
If a symbol lock is performed within a transaction, it is part of the transaction. If a Rollback occurs, the lock is reverted as all the updates done in the database.
You can lock symbols in another folder and even a server than the current one. In this case, Unlock frees all the locks created on the corresponding folder by the user.
Associated errors
| Error code | Description |
|---|---|
| 7 | The class does not exist (table not opened). |
| 10 | Argument has a bad data type. |
See also
Lock, Readlock, For, Close, Trbegin, Commit, Rollback, adxtlk.