|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.engine.DbObjectBase
org.h2.schema.Schema
public class Schema
A schema as created by the SQL statement CREATE SCHEMA
Field Summary |
---|
Fields inherited from class org.h2.engine.DbObjectBase |
---|
comment, database, trace |
Fields inherited from interface org.h2.engine.DbObject |
---|
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE |
Constructor Summary | |
---|---|
Schema(Database database,
int id,
java.lang.String schemaName,
User owner,
boolean system)
Create a new schema object. |
Method Summary | |
---|---|
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,
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. |
Constant |
findConstant(java.lang.String constantName)
Try to find a user defined constant with this name. |
Constraint |
findConstraint(Session session,
java.lang.String name)
Try to find a constraint with this name. |
FunctionAlias |
findFunction(java.lang.String functionAlias)
Try to find a user defined function with this name. |
Index |
findIndex(Session 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(Session 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()
Get all objects. |
java.util.ArrayList<SchemaObject> |
getAll(int type)
Get all objects of the given type. |
java.util.ArrayList<FunctionAlias> |
getAllFunctionAliases()
Get all functions. |
java.util.ArrayList<Table> |
getAllTablesAndViews()
Get all tables and views. |
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()
Build a SQL statement to re-create this object. |
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 |
java.lang.String |
getDropSQL()
Build a SQL statement to drop this object. |
Index |
getIndex(java.lang.String name)
Get the index with the given name. |
User |
getOwner()
Get the owner of this schema. |
Sequence |
getSequence(java.lang.String sequenceName)
Get the sequence with the given name. |
Table |
getTableOrView(Session session,
java.lang.String name)
Get the table or view with the given name. |
int |
getType()
Get the object type. |
java.lang.String |
getUniqueConstraintName(Session session,
Table table)
Create a unique constraint name. |
java.lang.String |
getUniqueIndexName(Session session,
Table table,
java.lang.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,
java.lang.String newName)
Rename an object. |
Methods inherited from class org.h2.engine.DbObjectBase |
---|
getChildren, getComment, getDatabase, getId, getModificationId, getName, getSQL, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Schema(Database database, int id, java.lang.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)Method Detail |
---|
public boolean canDrop()
public java.lang.String getCreateSQLForCopy(Table table, java.lang.String quotedName)
DbObjectBase
getCreateSQLForCopy
in interface DbObject
getCreateSQLForCopy
in class DbObjectBase
table
- the new table namequotedName
- the new quoted name
public java.lang.String getDropSQL()
DbObjectBase
getDropSQL
in interface DbObject
getDropSQL
in class DbObjectBase
public java.lang.String getCreateSQL()
DbObjectBase
getCreateSQL
in interface DbObject
getCreateSQL
in class DbObjectBase
public int getType()
DbObjectBase
getType
in interface DbObject
getType
in class DbObjectBase
public void removeChildrenAndResources(Session session)
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class DbObjectBase
session
- the sessionpublic void checkRename()
DbObjectBase
checkRename
in interface DbObject
checkRename
in class DbObjectBase
public User getOwner()
public 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(Session session, java.lang.String name)
session
- the sessionname
- the object name
public Index findIndex(Session session, java.lang.String name)
session
- the sessionname
- the object name
public TriggerObject findTrigger(java.lang.String name)
name
- the object name
public Sequence findSequence(java.lang.String sequenceName)
sequenceName
- the object name
public Constraint findConstraint(Session session, java.lang.String name)
session
- the sessionname
- the object name
public Constant findConstant(java.lang.String constantName)
constantName
- the object name
public FunctionAlias findFunction(java.lang.String functionAlias)
functionAlias
- the object name
public void freeUniqueName(java.lang.String name)
name
- the object namepublic java.lang.String getUniqueConstraintName(Session session, Table table)
session
- the sessiontable
- the constraint table
public java.lang.String getUniqueIndexName(Session session, Table table, java.lang.String prefix)
session
- the sessiontable
- the indexed tableprefix
- the index name prefix
public Table getTableOrView(Session session, java.lang.String name)
session
- the sessionname
- the table or view name
SQLException
- if no such object existspublic Index getIndex(java.lang.String name)
name
- the index name
SQLException
- if no such object existspublic Constraint getConstraint(java.lang.String name)
name
- the constraint name
SQLException
- if no such object existspublic Constant getConstant(java.lang.String constantName)
constantName
- the constant name
SQLException
- if no such object existspublic Sequence getSequence(java.lang.String sequenceName)
sequenceName
- the sequence name
SQLException
- if no such object existspublic java.util.ArrayList<SchemaObject> getAll()
public java.util.ArrayList<SchemaObject> getAll(int type)
type
- the object type
public java.util.ArrayList<Table> getAllTablesAndViews()
public java.util.ArrayList<FunctionAlias> getAllFunctionAliases()
public void remove(SchemaObject obj)
obj
- the object to removepublic Table createTable(CreateTableData data)
data
- the create table information
Table
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 accessed
TableLink
object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |