org.h2.engine

## Interface DbObject

All Known Subinterfaces:
  Index, MVIndex, SchemaObject, SpatialIndex

All Known Implementing Classes:
  BaseIndex, Comment, Constant, Constraint, ConstraintCheck, ConstraintReferential, ConstraintUnique, DbObjectBase, Domain, FunctionAlias, FunctionIndex, FunctionTable, HashIndex, LinkedIndex, MetaIndex, MetaTable, MVDelegateIndex, MVPrimaryIndex, MVSecondaryIndex, MVSpatialIndex, MVTable, NonUniqueHashIndex, PageBtreeIndex, PageDataIndex, PageDelegateIndex, PageIndex, PageStoreTable, RangeIndex, RangeTable, RegularTable, Right, RightOwner, Role, ScanIndex, Schema, SchemaObjectBase, Sequence, Setting, SpatialTreeIndex, Table, TableBase, TableLink, TableSynonym, TableView, TreeIndex, TriggerObject, User, UserAggregate, ViewIndex

    public interface DbObject

A database object such as a table, an index, or a user.

### Field Summary

Fields
`static int` `AGGREGATE` This object is a user-defined aggregate function.
`static int` `COMMENT` This object is a comment.
`static int` `CONSTANT` This object is a constant.
`static int` `CONSTRAINT` This object is a constraint (check constraint, unique constraint, or referential constraint).
`static int` `DOMAIN` This object is a domain.
`static int` `FUNCTION_ALIAS` This object is an alias for a Java function.
`static int` `INDEX` This object is an index.
`static int` `RIGHT` This object is a right.
`static int` `ROLE` This object is a role.
`static int` `SCHEMA` This object is a schema.
`static int` `SEQUENCE` This object is a sequence.
`static int` `SETTING` This object is a setting.
`static int` `SYNONYM` This object is a synonym.
`static int` `TABLE_OR_VIEW` The object is of the type table or view.
`static int` `TRIGGER` This object is a trigger.
`static int` `USER` This object is a user.

### Method Summary

Methods
`void` `checkRename()` Check if renaming is allowed.
`java.util.ArrayList<DbObject>` `getChildren()` Get the list of dependent children (for tables, this includes indexes and so on).
`java.lang.String` `getComment()` Get the current comment of this object.
`java.lang.String` `getCreateSQL()` Construct the original CREATE ...
`java.lang.String` `getCreateSQLForCopy(Table table, java.lang.String quotedName)` Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table
`Database` `getDatabase()` Get the database.
`java.lang.String` `getDropSQL()` Construct a DROP ...
`int` `getId()` Get the unique object id.
`java.lang.String` `getName()` Get the name.
`java.lang.String` `getSQL(boolean alwaysQuote)` Get the SQL name of this object (may be quoted).
`java.lang.StringBuilder` `getSQL(java.lang.StringBuilder builder, boolean alwaysQuote)` Appends the SQL name of this object (may be quoted) to the specified builder.
`int` `getType()` Get the object type.
`boolean` `isTemporary()` Check if this object is temporary (for example, a temporary table).
`void` `removeChildrenAndResources(Session session)` Delete all dependent children objects and resources of this object.
`void` `rename(java.lang.String newName)` Rename the object.
`void` `setComment(java.lang.String comment)` Change the comment of this object.
`void` `setTemporary(boolean temporary)` Tell this object that it is temporary or not.

### Field Detail

#### TABLE_OR_VIEW

    static final int TABLE_OR_VIEW

The object is of the type table or view.

See Also:
  Constant Field Values

#### INDEX

    static final int INDEX

This object is an index.

See Also:
  Constant Field Values

#### USER

    static final int USER

This object is a user.

See Also:
  Constant Field Values

#### SEQUENCE

    static final int SEQUENCE

This object is a sequence.

See Also:
  Constant Field Values

#### TRIGGER

    static final int TRIGGER

This object is a trigger.

See Also:
  Constant Field Values

#### CONSTRAINT

    static final int CONSTRAINT

This object is a constraint (check constraint, unique constraint, or referential constraint).

See Also:
  Constant Field Values

#### SETTING

    static final int SETTING

This object is a setting.

See Also:
  Constant Field Values

#### ROLE

    static final int ROLE

This object is a role.

See Also:
  Constant Field Values

#### RIGHT

    static final int RIGHT

This object is a right.

See Also:
  Constant Field Values

#### FUNCTION_ALIAS

    static final int FUNCTION_ALIAS

This object is an alias for a Java function.

See Also:
  Constant Field Values

#### SCHEMA

    static final int SCHEMA

This object is a schema.

See Also:
  Constant Field Values

#### CONSTANT

    static final int CONSTANT

This object is a constant.

See Also:
  Constant Field Values

#### DOMAIN

    static final int DOMAIN

This object is a domain.

See Also:
  Constant Field Values

#### COMMENT

    static final int COMMENT

This object is a comment.

See Also:
  Constant Field Values

#### AGGREGATE

    static final int AGGREGATE

This object is a user-defined aggregate function.

See Also:
  Constant Field Values

#### SYNONYM

    static final int SYNONYM

This object is a synonym.

See Also:
  Constant Field Values

### Method Detail

#### getSQL

    java.lang.String getSQL(boolean alwaysQuote)

Get the SQL name of this object (may be quoted).

Parameters:
  `alwaysQuote` - quote all identifiers
Returns:
  the SQL name

#### getSQL

    java.lang.StringBuilder getSQL(java.lang.StringBuilder builder,
                                 boolean alwaysQuote)

Appends the SQL name of this object (may be quoted) to the specified builder.

Parameters:
  `builder` - string builder
  `alwaysQuote` - quote all identifiers
Returns:
  the specified string builder

#### getChildren

    java.util.ArrayList<DbObject> getChildren()

Get the list of dependent children (for tables, this includes indexes and so on).

Returns:
  the list of children

#### getDatabase

    Database getDatabase()

Get the database.

Returns:
  the database

#### getId

    int getId()

Get the unique object id.

Returns:
  the object id

#### getName

    java.lang.String getName()

Get the name.

Returns:
  the name

#### getCreateSQLForCopy

    java.lang.String getCreateSQLForCopy(Table table,
                                       java.lang.String quotedName)

Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table

Parameters:
  `table` - the new table
  `quotedName` - the quoted name
Returns:
  the SQL statement

#### getCreateSQL

    java.lang.String getCreateSQL()

Construct the original CREATE ... SQL statement for this object.

Returns:
  the SQL statement

#### getDropSQL

    java.lang.String getDropSQL()

Construct a DROP ... SQL statement for this object.

Returns:
  the SQL statement

#### getType

    int getType()

Get the object type.

Returns:
  the object type

#### removeChildrenAndResources

    void removeChildrenAndResources(Session session)

Delete all dependent children objects and resources of this object.

Parameters:
  `session` - the session

#### checkRename

    void checkRename()

Check if renaming is allowed. Does nothing when allowed.

#### rename

    void rename(java.lang.String newName)

Rename the object.

Parameters:
  `newName` - the new name

#### isTemporary

    boolean isTemporary()

Check if this object is temporary (for example, a temporary table).

Returns:
  true if is temporary

#### setTemporary

    void setTemporary(boolean temporary)

Tell this object that it is temporary or not.

Parameters:
  `temporary` - the new value

#### setComment

    void setComment(java.lang.String comment)

Change the comment of this object.

Parameters:
  `comment` - the new comment, or null for no comment

#### getComment

    java.lang.String getComment()

Get the current comment of this object.

Returns:
  the comment, or null if not set