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