7.3.39. object_exist

7.3.39.1. Summary

New in version 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.

7.3.39.2. Syntax

This command takes only one required parameter:

object_exist name

7.3.39.3. Usage

You can check whether the name is already used in database:

Execution example:

object_exist Users
# [[0, 1337566253.89858, 0.000355720520019531], false]
table_create Users TABLE_HASH_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
object_exist Users
# [[0, 1337566253.89858, 0.000355720520019531], true]

The object_exist Users returns false before you create Users table.

The object_exist Users returns true after you create Users table.

7.3.39.4. Parameters

This section describes all parameters.

7.3.39.4.1. Required parameters

There is only one required parameters.

7.3.39.4.1.1. 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:

Execution example:

table_create Logs TABLE_NO_KEY
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create Logs timestamp COLUMN_SCALAR Time
# [[0, 1337566253.89858, 0.000355720520019531], true]
object_exist Logs.timestamp
# [[0, 1337566253.89858, 0.000355720520019531], true]

Logs is table name and timestamp is column name in Logs.timestamp.

7.3.39.4.2. Optional parameters

There is no optional parameter.

7.3.39.5. 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 Output format for HEADER.