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| 构造器和说明 |
|---|
Schema(Database database,
int id,
String schemaName,
RightOwner owner,
boolean system)
Create a new schema object.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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,
String tableName,
String driver,
String url,
String user,
String password,
String originalSchema,
String originalTable,
boolean emitUpdates,
boolean force)
Add a linked table to the schema.
|
UserAggregate |
findAggregate(String name)
Get the user defined aggregate function if it exists.
|
Constant |
findConstant(String constantName)
Try to find a user defined constant with this name.
|
Constraint |
findConstraint(SessionLocal session,
String name)
Try to find a constraint with this name.
|
Domain |
findDomain(String name)
Get the domain if it exists, or null if not.
|
FunctionAlias |
findFunction(String functionAlias)
Try to find a user defined function with this name.
|
UserDefinedFunction |
findFunctionOrAggregate(String name)
Try to find a user defined function or aggregate function with the
specified name.
|
Index |
findIndex(SessionLocal session,
String name)
Try to find an index with this name.
|
Sequence |
findSequence(String sequenceName)
Try to find a sequence with this name.
|
Table |
findTableOrView(SessionLocal session,
String name)
Try to find a table or view with this name.
|
TriggerObject |
findTrigger(String name)
Try to find a trigger with this name.
|
void |
freeUniqueName(String name)
Release a unique object name.
|
ArrayList<SchemaObject> |
getAll(ArrayList<SchemaObject> addTo)
Get all objects.
|
void |
getAll(int type,
ArrayList<SchemaObject> addTo)
Get all objects of the given type.
|
Collection<Constant> |
getAllConstants() |
Collection<Constraint> |
getAllConstraints() |
Collection<Domain> |
getAllDomains() |
Collection<UserDefinedFunction> |
getAllFunctionsAndAggregates() |
Collection<Index> |
getAllIndexes() |
Collection<Sequence> |
getAllSequences() |
Collection<TableSynonym> |
getAllSynonyms() |
Collection<Table> |
getAllTablesAndViews(SessionLocal session)
Get all tables and views.
|
Collection<TriggerObject> |
getAllTriggers() |
ArrayList<DbObject> |
getChildren()
Get the list of dependent children (for tables, this includes indexes and
so on).
|
Constant |
getConstant(String constantName)
Get the user defined constant with the given name.
|
Constraint |
getConstraint(String name)
Get the constraint with the given name.
|
String |
getCreateSQL()
Construct the CREATE ...
|
Domain |
getDomain(String name)
Get the domain with the given name.
|
Index |
getIndex(String name)
Get the index with the given name.
|
RightOwner |
getOwner()
Get the owner of this schema.
|
Sequence |
getSequence(String sequenceName)
Get the sequence with the given name.
|
TableSynonym |
getSynonym(String name)
Try to find a synonym with this name.
|
ArrayList<String> |
getTableEngineParams()
Get table engine params of this schema.
|
Table |
getTableOrView(SessionLocal session,
String name)
Get the table or view with the given name.
|
Table |
getTableOrViewByName(SessionLocal session,
String name)
Get the table with the given name, if any.
|
int |
getType()
Get the object type.
|
String |
getUniqueConstraintName(SessionLocal session,
Table table)
Create a unique constraint name.
|
String |
getUniqueDomainConstraintName(SessionLocal session,
Domain domain)
Create a unique constraint name.
|
String |
getUniqueIndexName(SessionLocal session,
Table table,
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,
String newName)
Rename an object.
|
void |
reserveUniqueName(String name)
Reserve a unique object name.
|
Table |
resolveTableOrView(SessionLocal session,
String name)
Try to find a table or view with this name.
|
void |
setTableEngineParams(ArrayList<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, 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 String getCreateSQL()
DbObjectgetCreateSQL 在类中 DbObjectpublic int getType()
DbObjectpublic boolean isEmpty()
true if this schema is empty, false otherwisepublic ArrayList<DbObject> getChildren()
DbObjectgetChildren 在类中 DbObjectnullpublic void removeChildrenAndResources(SessionLocal session)
DbObjectremoveChildrenAndResources 在类中 DbObjectsession - the sessionpublic RightOwner getOwner()
public ArrayList<String> getTableEngineParams()
public void setTableEngineParams(ArrayList<String> tableEngineParams)
tableEngineParams - default table engine paramspublic void add(SchemaObject obj)
obj - the object to addpublic void rename(SchemaObject obj, String newName)
obj - the object to renamenewName - the new namepublic Table findTableOrView(SessionLocal session, String name)
session - the sessionname - the object namepublic Table resolveTableOrView(SessionLocal session, String name)
session - the sessionname - the object namepublic TableSynonym getSynonym(String name)
name - the object namepublic Domain findDomain(String name)
name - the name of the domainpublic Index findIndex(SessionLocal session, String name)
session - the sessionname - the object namepublic TriggerObject findTrigger(String name)
name - the object namepublic Sequence findSequence(String sequenceName)
sequenceName - the object namepublic Constraint findConstraint(SessionLocal session, String name)
session - the sessionname - the object namepublic Constant findConstant(String constantName)
constantName - the object namepublic FunctionAlias findFunction(String functionAlias)
functionAlias - the object namepublic UserAggregate findAggregate(String name)
name - the name of the user defined aggregate functionpublic UserDefinedFunction findFunctionOrAggregate(String name)
name - the object namepublic void reserveUniqueName(String name)
name - the object namepublic void freeUniqueName(String name)
name - the object namepublic String getUniqueConstraintName(SessionLocal session, Table table)
session - the sessiontable - the constraint tablepublic String getUniqueDomainConstraintName(SessionLocal session, Domain domain)
session - the sessiondomain - the constraint domainpublic String getUniqueIndexName(SessionLocal session, Table table, String prefix)
session - the sessiontable - the indexed tableprefix - the index name prefixpublic Table getTableOrView(SessionLocal session, String name)
session - the sessionname - the table or view nameDbException - if no such object existspublic Domain getDomain(String name)
name - the domain nameDbException - if no such object existspublic Index getIndex(String name)
name - the index nameDbException - if no such object existspublic Constraint getConstraint(String name)
name - the constraint nameDbException - if no such object existspublic Constant getConstant(String constantName)
constantName - the constant nameDbException - if no such object existspublic Sequence getSequence(String sequenceName)
sequenceName - the sequence nameDbException - if no such object existspublic ArrayList<SchemaObject> getAll(ArrayList<SchemaObject> addTo)
addTo - list to add objects to, or null to allocate a new
listpublic void getAll(int type,
ArrayList<SchemaObject> addTo)
type - the object typeaddTo - list to add objects topublic Collection<Domain> getAllDomains()
public Collection<Constraint> getAllConstraints()
public Collection<Constant> getAllConstants()
public Collection<Sequence> getAllSequences()
public Collection<TriggerObject> getAllTriggers()
public Collection<Table> getAllTablesAndViews(SessionLocal session)
session - the session, null to exclude meta tablespublic Collection<Index> getAllIndexes()
public Collection<TableSynonym> getAllSynonyms()
public Collection<UserDefinedFunction> getAllFunctionsAndAggregates()
public Table getTableOrViewByName(SessionLocal session, 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, String tableName, String driver, String url, String user, String password, String originalSchema, 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 objectCopyright © 2022. All rights reserved.