7.3.27. lock_acquire# Summary#

New in version 5.1.2.

lock_acquire command acquires the lock of the target object. The target object is one of database, table and column.


This is a dangerous command. You must release locks by lock_release that you acquire when these locks are no longer needed. If you forget to release these locks, your database may be broken. Syntax#

This command takes only one optional parameter:

lock_acquire [target_name=null]

If target_name parameters is omitted, database is used for the target object. Usage#

Here is an example to acquire the lock of the database:

Execution example:

# [[0,1337566253.89858,0.000355720520019531],true]

If the database is locked, you can’t create a new table and column. Release the lock of the database to show another examples.

Execution example:

# [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to acquire the lock of Entries table:

Execution example:

table_create Entries TABLE_NO_KEY
# [[0,1337566253.89858,0.000355720520019531],true]
lock_acquire Entries
# [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to acquire the lock of Sites.title column:

Execution example:

table_create Sites TABLE_HASH_KEY ShortText
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Sites title COLUMN_SCALAR ShortText
# [[0,1337566253.89858,0.000355720520019531],true]
lock_acquire Sites.title
# [[0,1337566253.89858,0.000355720520019531],true] Parameters#

This section describes all parameters. target_name#

Specifies the name of table or column.

If you don’t specify it, database is used for the target object.

The default is none. It means that the target object is database. Return value#

lock_acquire command returns whether lock is acquired or not:


If command succeeded, it returns true, otherwise it returns false on error. See also#