org.h2.engine
Interface DbObject

All Known Subinterfaces:
Index, RowIndex, SchemaObject
All Known Implementing Classes:
BaseHashIndex, BaseIndex, BtreeIndex, Comment, Constant, Constraint, ConstraintCheck, ConstraintReferential, ConstraintUnique, DbObjectBase, FunctionAlias, FunctionIndex, FunctionTable, HashIndex, LinkedIndex, MetaIndex, MetaTable, MultiVersionIndex, NonUniqueHashIndex, PageBtreeIndex, PageDataIndex, PageDelegateIndex, PageIndex, RangeIndex, RangeTable, Right, RightOwner, Role, ScanIndex, Schema, SchemaObjectBase, Sequence, Setting, Table, TableData, TableLink, TableView, TreeIndex, TriggerObject, User, UserAggregate, UserDataType, ViewIndex

public interface DbObject

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


Field Summary
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 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 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.
static int USER_DATATYPE
          This object is a user data type (domain).
 
Method Summary
 void checkRename()
          Check if renaming is allowed.
 ObjectArray<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)
          Construct a CREATE ...
 Database getDatabase()
          Get the database.
 java.lang.String getDropSQL()
          Construct a DROP ...
 int getHeadPos()
          Get the position of the head record.
 int getId()
          Get the unique object id.
 long getModificationId()
          Get the last modification id.
 java.lang.String getName()
          Get the name.
 java.lang.String getSQL()
          Get the SQL name of this object (may be quoted).
 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 setModified()
          Tell the object that is was modified.
 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

USER_DATATYPE

static final int USER_DATATYPE
This object is a user data type (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
Method Detail

setModified

void setModified()
Tell the object that is was modified.


getModificationId

long getModificationId()
Get the last modification id.

Returns:
the modification id

getSQL

java.lang.String getSQL()
Get the SQL name of this object (may be quoted).

Returns:
the SQL name

getChildren

ObjectArray<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)
Construct a CREATE ... SQL statement for this object when creating a copy of it.

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)
                                throws java.sql.SQLException
Delete all dependent children objects and resources of this object.

Parameters:
session - the session
Throws:
java.sql.SQLException

checkRename

void checkRename()
                 throws java.sql.SQLException
Check if renaming is allowed. Does nothing when allowed.

Throws:
java.sql.SQLException - if renaming is not allowed

rename

void rename(java.lang.String newName)
            throws java.sql.SQLException
Rename the object.

Parameters:
newName - the new name
Throws:
java.sql.SQLException

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

getHeadPos

int getHeadPos()
Get the position of the head record.

Returns:
the head position