public class Schema extends DbObject
AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USERADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS| Constructor and Description |
|---|
Schema(Database database,
int id,
java.lang.String schemaName,
RightOwner owner,
boolean system)
Create a new schema object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(SchemaObject obj)
Add an object to this schema.
|
boolean |
canDrop()
Check if this schema can be dropped.
|
TableSynonym |
createSynonym(CreateSynonymData data)
Add a table synonym to the schema.
|
Table |
createTable(CreateTableData data)
Add a table to the schema.
|
TableLink |
createTableLink(int id,
java.lang.String tableName,
java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String originalSchema,
java.lang.String originalTable,
boolean emitUpdates,
boolean force)
Add a linked table to the schema.
|
UserAggregate |
findAggregate(java.lang.String name)
Get the user defined aggregate function if it exists.
|
Constant |
findConstant(java.lang.String constantName)
Try to find a user defined constant with this name.
|
Constraint |
findConstraint(SessionLocal session,
java.lang.String name)
Try to find a constraint with this name.
|
Domain |
findDomain(java.lang.String name)
Get the domain if it exists, or null if not.
|
FunctionAlias |
findFunction(java.lang.String functionAlias)
Try to find a user defined function with this name.
|
UserDefinedFunction |
findFunctionOrAggregate(java.lang.String name)
Try to find a user defined function or aggregate function with the
specified name.
|
Index |
findIndex(SessionLocal session,
java.lang.String name)
Try to find an index with this name.
|
Sequence |
findSequence(java.lang.String sequenceName)
Try to find a sequence with this name.
|
Table |
findTableOrView(SessionLocal session,
java.lang.String name)
Try to find a table or view with this name.
|
TriggerObject |
findTrigger(java.lang.String name)
Try to find a trigger with this name.
|
void |
freeUniqueName(java.lang.String name)
Release a unique object name.
|
java.util.ArrayList<SchemaObject> |
getAll(java.util.ArrayList<SchemaObject> addTo)
Get all objects.
|
void |
getAll(int type,
java.util.ArrayList<SchemaObject> addTo)
Get all objects of the given type.
|
java.util.Collection<Constant> |
getAllConstants() |
java.util.Collection<Constraint> |
getAllConstraints() |
java.util.Collection<Domain> |
getAllDomains() |
java.util.Collection<UserDefinedFunction> |
getAllFunctionsAndAggregates() |
java.util.Collection<Index> |
getAllIndexes() |
java.util.Collection<Sequence> |
getAllSequences() |
java.util.Collection<TableSynonym> |
getAllSynonyms() |
java.util.Collection<Table> |
getAllTablesAndViews(SessionLocal session)
Get all tables and views.
|
java.util.Collection<TriggerObject> |
getAllTriggers() |
java.util.ArrayList<DbObject> |
getChildren()
Get the list of dependent children (for tables, this includes indexes and
so on).
|
Constant |
getConstant(java.lang.String constantName)
Get the user defined constant with the given name.
|
Constraint |
getConstraint(java.lang.String name)
Get the constraint with the given name.
|
java.lang.String |
getCreateSQL()
Construct the CREATE ...
|
Domain |
getDomain(java.lang.String name)
Get the domain with the given name.
|
Index |
getIndex(java.lang.String name)
Get the index with the given name.
|
RightOwner |
getOwner()
Get the owner of this schema.
|
Sequence |
getSequence(java.lang.String sequenceName)
Get the sequence with the given name.
|
TableSynonym |
getSynonym(java.lang.String name)
Try to find a synonym with this name.
|
java.util.ArrayList<java.lang.String> |
getTableEngineParams()
Get table engine params of this schema.
|
Table |
getTableOrView(SessionLocal session,
java.lang.String name)
Get the table or view with the given name.
|
Table |
getTableOrViewByName(SessionLocal session,
java.lang.String name)
Get the table with the given name, if any.
|
int |
getType()
Get the object type.
|
java.lang.String |
getUniqueConstraintName(SessionLocal session,
Table table)
Create a unique constraint name.
|
java.lang.String |
getUniqueDomainConstraintName(SessionLocal session,
Domain domain)
Create a unique constraint name.
|
java.lang.String |
getUniqueIndexName(SessionLocal session,
Table table,
java.lang.String prefix)
Create a unique index name.
|
boolean |
isEmpty()
Return whether is this schema is empty (does not contain any objects).
|
void |
remove(SchemaObject obj)
Remove an object from this schema.
|
void |
removeChildrenAndResources(SessionLocal session)
Delete all dependent children objects and resources of this object.
|
void |
rename(SchemaObject obj,
java.lang.String newName)
Rename an object.
|
void |
reserveUniqueName(java.lang.String name)
Reserve a unique object name.
|
Table |
resolveTableOrView(SessionLocal session,
java.lang.String name)
Try to find a table or view with this name.
|
void |
setTableEngineParams(java.util.ArrayList<java.lang.String> tableEngineParams)
Set table engine params of this schema.
|
checkRename, getComment, getCreateSQLForCopy, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, getSQL, getSQL, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTraceSQLpublic Schema(Database database, int id, java.lang.String schemaName, RightOwner owner, boolean system)
database - the databaseid - the object idschemaName - the schema nameowner - the owner of the schemasystem - if this is a system schema (such a schema can not be
dropped)public boolean canDrop()
public java.lang.String getCreateSQL()
DbObjectgetCreateSQL in class DbObjectpublic int getType()
DbObjectpublic boolean isEmpty()
true if this schema is empty, false otherwisepublic java.util.ArrayList<DbObject> getChildren()
DbObjectgetChildren in class DbObjectnullpublic void removeChildrenAndResources(SessionLocal session)
DbObjectremoveChildrenAndResources in class DbObjectsession - the sessionpublic RightOwner getOwner()
public java.util.ArrayList<java.lang.String> getTableEngineParams()
public void setTableEngineParams(java.util.ArrayList<java.lang.String> tableEngineParams)
tableEngineParams - default table engine paramspublic void add(SchemaObject obj)
obj - the object to addpublic void rename(SchemaObject obj, java.lang.String newName)
obj - the object to renamenewName - the new namepublic Table findTableOrView(SessionLocal session, java.lang.String name)
session - the sessionname - the object namepublic Table resolveTableOrView(SessionLocal session, java.lang.String name)
session - the sessionname - the object namepublic TableSynonym getSynonym(java.lang.String name)
name - the object namepublic Domain findDomain(java.lang.String name)
name - the name of the domainpublic Index findIndex(SessionLocal session, java.lang.String name)
session - the sessionname - the object namepublic TriggerObject findTrigger(java.lang.String name)
name - the object namepublic Sequence findSequence(java.lang.String sequenceName)
sequenceName - the object namepublic Constraint findConstraint(SessionLocal session, java.lang.String name)
session - the sessionname - the object namepublic Constant findConstant(java.lang.String constantName)
constantName - the object namepublic FunctionAlias findFunction(java.lang.String functionAlias)
functionAlias - the object namepublic UserAggregate findAggregate(java.lang.String name)
name - the name of the user defined aggregate functionpublic UserDefinedFunction findFunctionOrAggregate(java.lang.String name)
name - the object namepublic void reserveUniqueName(java.lang.String name)
name - the object namepublic void freeUniqueName(java.lang.String name)
name - the object namepublic java.lang.String getUniqueConstraintName(SessionLocal session, Table table)
session - the sessiontable - the constraint tablepublic java.lang.String getUniqueDomainConstraintName(SessionLocal session, Domain domain)
session - the sessiondomain - the constraint domainpublic java.lang.String getUniqueIndexName(SessionLocal session, Table table, java.lang.String prefix)
session - the sessiontable - the indexed tableprefix - the index name prefixpublic Table getTableOrView(SessionLocal session, java.lang.String name)
session - the sessionname - the table or view nameDbException - if no such object existspublic Domain getDomain(java.lang.String name)
name - the domain nameDbException - if no such object existspublic Index getIndex(java.lang.String name)
name - the index nameDbException - if no such object existspublic Constraint getConstraint(java.lang.String name)
name - the constraint nameDbException - if no such object existspublic Constant getConstant(java.lang.String constantName)
constantName - the constant nameDbException - if no such object existspublic Sequence getSequence(java.lang.String sequenceName)
sequenceName - the sequence nameDbException - if no such object existspublic java.util.ArrayList<SchemaObject> getAll(java.util.ArrayList<SchemaObject> addTo)
addTo - list to add objects to, or null to allocate a new
listpublic void getAll(int type,
java.util.ArrayList<SchemaObject> addTo)
type - the object typeaddTo - list to add objects topublic java.util.Collection<Domain> getAllDomains()
public java.util.Collection<Constraint> getAllConstraints()
public java.util.Collection<Constant> getAllConstants()
public java.util.Collection<Sequence> getAllSequences()
public java.util.Collection<TriggerObject> getAllTriggers()
public java.util.Collection<Table> getAllTablesAndViews(SessionLocal session)
session - the session, null to exclude meta tablespublic java.util.Collection<Index> getAllIndexes()
public java.util.Collection<TableSynonym> getAllSynonyms()
public java.util.Collection<UserDefinedFunction> getAllFunctionsAndAggregates()
public Table getTableOrViewByName(SessionLocal session, java.lang.String name)
session - the sessionname - the table namepublic void remove(SchemaObject obj)
obj - the object to removepublic Table createTable(CreateTableData data)
data - the create table informationTable objectpublic TableSynonym createSynonym(CreateSynonymData data)
data - the create synonym informationTableSynonym objectpublic TableLink createTableLink(int id, java.lang.String tableName, java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String originalSchema, java.lang.String originalTable, boolean emitUpdates, boolean force)
id - the object idtableName - the table name of the aliasdriver - the driver class nameurl - the database URLuser - the user namepassword - the passwordoriginalSchema - the schema name of the target tableoriginalTable - the table name of the target tableemitUpdates - if updates should be emitted instead of delete/insertforce - create the object even if the database can not be accessedTableLink object