|
||||||||
| 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.SchemaObjectBase
org.h2.constraint.Constraint
org.h2.constraint.ConstraintReferential
public class ConstraintReferential
A referential constraint.
| Field Summary | |
|---|---|
static int |
CASCADE
The action is to cascade the operation. |
static int |
RESTRICT
The action is to restrict the operation. |
static int |
SET_DEFAULT
The action is to set the value to the default value. |
static int |
SET_NULL
The action is to set the value to NULL. |
| Fields inherited from class org.h2.constraint.Constraint |
|---|
CHECK, PRIMARY_KEY, REFERENTIAL, table, UNIQUE |
| 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 | |
|---|---|
ConstraintReferential(Schema schema,
int id,
java.lang.String name,
Table table)
|
|
| Method Summary | |
|---|---|
void |
checkExistingData(Session session)
Check the existing data. |
void |
checkRow(Session session,
Table t,
Row oldRow,
Row newRow)
Check if this row fulfils the constraint. |
IndexColumn[] |
getColumns()
|
java.lang.String |
getConstraintType()
The constraint type name |
java.lang.String |
getCreateSQL()
Build a SQL statement to re-create this object. |
java.lang.String |
getCreateSQLForCopy(Table forTable,
java.lang.String quotedName)
Create the SQL statement of this object so a copy of the table can be made. |
java.lang.String |
getCreateSQLForCopy(Table forTable,
Table forRefTable,
java.lang.String quotedName,
boolean internalIndex)
Create the SQL statement of this object so a copy of the table can be made. |
java.lang.String |
getCreateSQLWithoutIndexes()
Get the SQL statement to create this constraint. |
int |
getDeleteAction()
|
IndexColumn[] |
getRefColumns()
|
java.util.HashSet<Column> |
getReferencedColumns(Table table)
Get all referenced columns. |
Table |
getRefTable()
|
Index |
getUniqueIndex()
Get the unique index used to enforce this constraint, or null if no index is used. |
int |
getUpdateAction()
|
boolean |
isBefore()
Check if this constraint needs to be checked before updating the data. |
void |
rebuild()
This method is called after a related table has changed (the table was renamed, or columns have been renamed). |
void |
removeChildrenAndResources(Session session)
Remove all dependent objects and free all resources (files, blocks in files) of this object. |
void |
setColumns(IndexColumn[] cols)
|
void |
setDeleteAction(int action)
Set the action to apply (restrict, cascade,...) on a delete. |
void |
setIndex(Index index,
boolean isOwner)
Set the index to use for this constraint. |
void |
setIndexOwner(Index index)
This index is now the owner of the specified index. |
void |
setRefColumns(IndexColumn[] refCols)
|
void |
setRefIndex(Index refIndex,
boolean isRefOwner)
Set the index of the referenced table to use for this constraint. |
void |
setRefTable(Table refTable)
|
void |
setUpdateAction(int action)
Set the action to apply (restrict, cascade,...) on an update. |
boolean |
usesIndex(Index idx)
Check if this constraint needs the specified index. |
| Methods inherited from class org.h2.constraint.Constraint |
|---|
checkRename, compareTo, getDropSQL, getTable, getType, isEverything, isHidden |
| Methods inherited from class org.h2.schema.SchemaObjectBase |
|---|
getSchema, getSQL, initSchemaObjectBase |
| Methods inherited from class org.h2.engine.DbObjectBase |
|---|
getChildren, getComment, getDatabase, getId, getModificationId, getName, 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 |
| Methods inherited from interface org.h2.engine.DbObject |
|---|
getChildren, getComment, getDatabase, getId, getName, isTemporary, rename, setComment, setTemporary |
| Field Detail |
|---|
public static final int RESTRICT
public static final int CASCADE
public static final int SET_DEFAULT
public static final int SET_NULL
| Constructor Detail |
|---|
public ConstraintReferential(Schema schema,
int id,
java.lang.String name,
Table table)
| Method Detail |
|---|
public java.lang.String getConstraintType()
Constraint
getConstraintType in class Constraint
public java.lang.String getCreateSQLForCopy(Table forTable,
java.lang.String quotedName)
forTable - the table to create the object forquotedName - the name of this object (quoted if necessary)
public java.lang.String getCreateSQLForCopy(Table forTable,
Table forRefTable,
java.lang.String quotedName,
boolean internalIndex)
forTable - the table to create the object forforRefTable - the referenced tablequotedName - the name of this object (quoted if necessary)internalIndex - add the index name to the statement
public java.lang.String getCreateSQLWithoutIndexes()
Constraint
getCreateSQLWithoutIndexes in class Constraintpublic java.lang.String getCreateSQL()
DbObjectBase
getCreateSQL in interface DbObjectgetCreateSQL in class DbObjectBasepublic void setColumns(IndexColumn[] cols)
public IndexColumn[] getColumns()
public java.util.HashSet<Column> getReferencedColumns(Table table)
Constraint
getReferencedColumns in class Constrainttable - the table
public void setRefColumns(IndexColumn[] refCols)
public IndexColumn[] getRefColumns()
public void setRefTable(Table refTable)
public void setIndex(Index index,
boolean isOwner)
index - the indexisOwner - true if the index is generated by the system and belongs
to this constraint
public void setRefIndex(Index refIndex,
boolean isRefOwner)
refIndex - the indexisRefOwner - true if the index is generated by the system and
belongs to this constraintpublic void removeChildrenAndResources(Session session)
DbObjectBase
removeChildrenAndResources in interface DbObjectremoveChildrenAndResources in class DbObjectBasesession - the session
public void checkRow(Session session,
Table t,
Row oldRow,
Row newRow)
Constraint
checkRow in class Constraintsession - the sessiont - the tableoldRow - the old rownewRow - the new rowpublic int getDeleteAction()
public void setDeleteAction(int action)
action - the actionpublic int getUpdateAction()
public void setUpdateAction(int action)
action - the actionpublic void rebuild()
Constraint
rebuild in class Constraintpublic Table getRefTable()
getRefTable in class Constraintpublic boolean usesIndex(Index idx)
Constraint
usesIndex in class Constraintidx - the index
public void setIndexOwner(Index index)
Constraint
setIndexOwner in class Constraintindex - the indexpublic boolean isBefore()
Constraint
isBefore in class Constraintpublic void checkExistingData(Session session)
Constraint
checkExistingData in class Constraintsession - the sessionpublic Index getUniqueIndex()
Constraint
getUniqueIndex in class Constraint
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||