public class Schema extends DbObjectBase
comment, database, traceAGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE| 构造器和说明 |
|---|
Schema(Database database,
int id,
String schemaName,
User 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.
|
void |
checkRename()
Check if this object can be renamed.
|
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.
|
Constant |
findConstant(String constantName)
Try to find a user defined constant with this name.
|
Constraint |
findConstraint(Session session,
String name)
Try to find a constraint with this name.
|
FunctionAlias |
findFunction(String functionAlias)
Try to find a user defined function with this name.
|
Index |
findIndex(Session 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(Session 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()
Get all objects.
|
ArrayList<SchemaObject> |
getAll(int type)
Get all objects of the given type.
|
ArrayList<Table> |
getAllTablesAndViews()
Get all tables and views.
|
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()
Build a SQL statement to re-create this object.
|
String |
getCreateSQLForCopy(Table table,
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
|
String |
getDropSQL()
Build a SQL statement to drop this object.
|
Index |
getIndex(String name)
Get the index with the given name.
|
User |
getOwner()
Get the owner of this schema.
|
Sequence |
getSequence(String sequenceName)
Get the sequence with the given name.
|
Table |
getTableOrView(Session session,
String name)
Get the table or view with the given name.
|
Table |
getTableOrViewByName(String name)
Get the table with the given name, if any.
|
int |
getType()
Get the object type.
|
String |
getUniqueConstraintName(Session session,
Table table)
Create a unique constraint name.
|
String |
getUniqueIndexName(Session session,
Table table,
String prefix)
Create a unique index name.
|
void |
remove(SchemaObject obj)
Remove an object from this schema.
|
void |
removeChildrenAndResources(Session session)
Remove all dependent objects and free all resources (files, blocks in
files) of this object.
|
void |
rename(SchemaObject obj,
String newName)
Rename an object.
|
getChildren, getComment, getDatabase, getId, getModificationId, getName, getSQL, initDbObjectBase, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toStringpublic Schema(Database database, int id, String schemaName, User 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 getCreateSQLForCopy(Table table, String quotedName)
DbObjecttable - the new tablequotedName - the quoted namepublic String getDropSQL()
DbObjectBasegetDropSQL 在接口中 DbObjectgetDropSQL 在类中 DbObjectBasepublic String getCreateSQL()
DbObjectBasegetCreateSQL 在接口中 DbObjectgetCreateSQL 在类中 DbObjectBasepublic int getType()
DbObjectpublic void removeChildrenAndResources(Session session)
DbObjectBaseremoveChildrenAndResources 在接口中 DbObjectremoveChildrenAndResources 在类中 DbObjectBasesession - the sessionpublic void checkRename()
DbObjectBasecheckRename 在接口中 DbObjectcheckRename 在类中 DbObjectBasepublic User getOwner()
public 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(Session session, String name)
session - the sessionname - the object namepublic Index findIndex(Session 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(Session 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 void freeUniqueName(String name)
name - the object namepublic String getUniqueConstraintName(Session session, Table table)
session - the sessiontable - the constraint tablepublic String getUniqueIndexName(Session session, Table table, String prefix)
session - the sessiontable - the indexed tableprefix - the index name prefixpublic Table getTableOrView(Session session, String name)
session - the sessionname - the table or view 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()
public ArrayList<SchemaObject> getAll(int type)
type - the object typepublic ArrayList<Table> getAllTablesAndViews()
public Table getTableOrViewByName(String name)
name - the table namepublic void remove(SchemaObject obj)
obj - the object to removepublic Table createTable(CreateTableData data)
data - the create table informationTable 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 © 2017. All rights reserved.