Debian Codegraph @

doc/source/reference/commands/lock_acquire.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: lock_acquire
5
6 ``lock_acquire``
7 ================
8
9 Summary
10 -------
11
12 .. versionadded:: 5.1.2
13
14 ``lock_acquire`` command acquires the lock of the target object. The
15 target object is one of database, table and column.
16
17 .. note::
18
19 This is a dangerous command. You must release locks by
20 :doc:`lock_release` that you acquire when these locks are no longer
21 needed. If you forget to release these locks, your database may be
22 broken.
23
24 Syntax
25 ------
26
27 This command takes only one optional parameter::
28
29 lock_acquire [target_name=null]
30
31 If ``target_name`` parameters is omitted, database is used for the
32 target object.
33
34 Usage
35 -----
36
37 Here is an example to acquire the lock of the database:
38
39 .. groonga-command
40 .. include:: ../../example/reference/commands/lock_acquire/database.log
41 .. lock_acquire
42
43 If the database is locked, you can't create a new table and
44 column. Release the lock of the database to show another examples.
45
46 .. groonga-command
47 .. include:: ../../example/reference/commands/lock_acquire/database_release.log
48 .. lock_release
49
50 Here is an example to acquire the lock of ``Entries`` table:
51
52 .. groonga-command
53 .. include:: ../../example/reference/commands/lock_acquire/table.log
54 .. table_create Entries TABLE_NO_KEY
55 .. lock_acquire Entries
56
57 Here is an example to acquire the lock of ``Sites.title`` column:
58
59 .. groonga-command
60 .. include:: ../../example/reference/commands/lock_acquire/column.log
61 .. table_create Sites TABLE_HASH_KEY ShortText
62 .. column_create Sites title COLUMN_SCALAR ShortText
63 .. lock_acquire Sites.title
64
65 Parameters
66 ----------
67
68 This section describes all parameters.
69
70 ``target_name``
71 """""""""""""""
72
73 Specifies the name of table or column.
74
75 If you don't specify it, database is used for the target object.
76
77 The default is none. It means that the target object is database.
78
79 Return value
80 ------------
81
82 ``lock_acquire`` command returns whether lock is acquired or not::
83
84 [HEADER, SUCCEEDED_OR_NOT]
85
86 ``HEADER``
87 """"""""""
88
89 See :doc:`/reference/command/output_format` about ``HEADER``.
90
91 ``SUCCEEDED_OR_NOT``
92 """"""""""""""""""""
93
94 If command succeeded, it returns true, otherwise it returns false on error.
95
96 See also
97 --------
98
99 * :doc:`lock_release`
100 * :doc:`lock_clear`