public class ConstraintUnique extends Constraint
CHECK, PRIMARY_KEY, REFERENTIAL, table, UNIQUEcomment, database, traceAGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE| Constructor and Description |
|---|
ConstraintUnique(Schema schema,
int id,
String name,
Table table,
boolean primaryKey) |
| Modifier and Type | Method and Description |
|---|---|
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() |
String |
getConstraintType()
The constraint type name
|
String |
getCreateSQL()
Build a SQL statement to re-create this object.
|
String |
getCreateSQLForCopy(Table forTable,
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 |
getCreateSQLWithoutIndexes()
Get the SQL statement to create this constraint.
|
HashSet<Column> |
getReferencedColumns(Table table)
Get all referenced columns.
|
Index |
getUniqueIndex()
Get the unique index used to enforce this constraint, or null if no index
is used.
|
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[] columns) |
void |
setIndex(Index index,
boolean isOwner)
Set the index to use for this unique constraint.
|
void |
setIndexOwner(Index index)
This index is now the owner of the specified index.
|
boolean |
usesIndex(Index idx)
Check if this constraint needs the specified index.
|
checkRename, compareTo, getDropSQL, getRefTable, getTable, getType, isEverything, isHiddengetSchema, getSQL, initSchemaObjectBasegetChildren, getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChildren, getComment, getDatabase, getId, getName, isTemporary, rename, setComment, setTemporarypublic String getConstraintType()
ConstraintgetConstraintType in class Constraintpublic String getCreateSQLForCopy(Table forTable, String quotedName)
DbObjectforTable - the new tablequotedName - the quoted namepublic String getCreateSQLWithoutIndexes()
ConstraintgetCreateSQLWithoutIndexes in class Constraintpublic String getCreateSQL()
DbObjectBasegetCreateSQL in interface DbObjectgetCreateSQL in class DbObjectBasepublic void setColumns(IndexColumn[] columns)
public IndexColumn[] getColumns()
public void setIndex(Index index, boolean isOwner)
index - the indexisOwner - true if the index is generated by the system and belongs
to this constraintpublic void removeChildrenAndResources(Session session)
DbObjectBaseremoveChildrenAndResources in interface DbObjectremoveChildrenAndResources in class DbObjectBasesession - the sessionpublic void checkRow(Session session, Table t, Row oldRow, Row newRow)
ConstraintcheckRow in class Constraintsession - the sessiont - the tableoldRow - the old rownewRow - the new rowpublic boolean usesIndex(Index idx)
ConstraintusesIndex in class Constraintidx - the indexpublic void setIndexOwner(Index index)
ConstraintsetIndexOwner in class Constraintindex - the indexpublic HashSet<Column> getReferencedColumns(Table table)
ConstraintgetReferencedColumns in class Constrainttable - the tablepublic boolean isBefore()
ConstraintisBefore in class Constraintpublic void checkExistingData(Session session)
ConstraintcheckExistingData in class Constraintsession - the sessionpublic Index getUniqueIndex()
ConstraintgetUniqueIndex in class Constraintpublic void rebuild()
Constraintrebuild in class ConstraintCopyright © 2012 JBoss by Red Hat. All Rights Reserved.