Debian Codegraph @

doc/source/reference/commands/object_exist.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: commands_object_exist
5
6 ``object_exist``
7 ================
8
9 Summary
10 -------
11
12 .. versionadded:: 5.0.6
13
14 ``object_exist`` returns whether object with the specified name exists
15 or not in database.
16
17 It's a light operation. It just checks existence of the name in the
18 database. It doesn't load the specified object from disk.
19
20 ``object_exist`` doesn't check object type. The existing object may be
21 table, column, function and so on.
22
23 Syntax
24 ------
25
26 This command takes only one required parameter::
27
28 object_exist name
29
30 Usage
31 -----
32
33 You can check whether the name is already used in database:
34
35 .. groonga-command
36 .. include:: ../../example/reference/commands/object_exist/usage.log
37 .. object_exist Users
38 .. table_create Users TABLE_HASH_KEY ShortText
39 .. object_exist Users
40
41 The ``object_exist Users`` returns ``false`` before you create
42 ``Users`` table.
43
44 The ``object_exist Users`` returns ``true`` after you create ``Users``
45 table.
46
47 Parameters
48 ----------
49
50 This section describes all parameters.
51
52 Required parameters
53 ^^^^^^^^^^^^^^^^^^^
54
55 There is only one required parameter.
56
57 .. _object-exist-name:
58
59 ``name``
60 """"""""
61
62 Specifies the object name to be checked.
63
64 If you want to check existence of a column, use
65 ``TABLE_NAME.COLUMN_NAME`` format like the following:
66
67 .. groonga-command
68 .. include:: ../../example/reference/commands/object_exist/name_column.log
69 .. table_create Logs TABLE_NO_KEY
70 .. column_create Logs timestamp COLUMN_SCALAR Time
71 .. object_exist Logs.timestamp
72
73 ``Logs`` is table name and ``timestamp`` is column name in
74 ``Logs.timestamp``.
75
76 Optional parameters
77 ^^^^^^^^^^^^^^^^^^^
78
79 There is no optional parameter.
80
81 Return value
82 ------------
83
84 The command returns ``true`` as body if object with the specified name
85 exists in database such as::
86
87 [HEADER, true]
88
89 The command returns ``false`` otherwise such as::
90
91 [HEADER, false]
92
93 See :doc:`/reference/command/output_format` for ``HEADER``.