public class ConstraintCheck extends Constraint
CHECK, PRIMARY_KEY, REFERENTIAL, table, UNIQUE
comment, database, trace
AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE
Constructor and Description |
---|
ConstraintCheck(Schema schema,
int id,
String name,
Table table) |
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.
|
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.
|
Expression |
getExpression() |
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.
|
boolean |
isEverything(ExpressionVisitor visitor)
Visit all elements in the constraint.
|
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 |
setExpression(Expression expr) |
void |
setIndexOwner(Index index)
This index is now the owner of the specified index.
|
void |
setTableFilter(TableFilter filter) |
boolean |
usesIndex(Index index)
Check if this constraint needs the specified index.
|
checkRename, compareTo, getDropSQL, getRefTable, getTable, getType, isHidden
getSchema, getSQL, initSchemaObjectBase
getChildren, getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChildren, getComment, getDatabase, getId, getName, isTemporary, rename, setComment, setTemporary
public String getConstraintType()
Constraint
getConstraintType
in class Constraint
public void setTableFilter(TableFilter filter)
public void setExpression(Expression expr)
public String getCreateSQLForCopy(Table forTable, String quotedName)
DbObject
forTable
- the new tablequotedName
- the quoted namepublic String getCreateSQLWithoutIndexes()
Constraint
getCreateSQLWithoutIndexes
in class Constraint
public String getCreateSQL()
DbObjectBase
getCreateSQL
in interface DbObject
getCreateSQL
in class DbObjectBase
public void removeChildrenAndResources(Session session)
DbObjectBase
removeChildrenAndResources
in interface DbObject
removeChildrenAndResources
in class DbObjectBase
session
- the sessionpublic void checkRow(Session session, Table t, Row oldRow, Row newRow)
Constraint
checkRow
in class Constraint
session
- the sessiont
- the tableoldRow
- the old rownewRow
- the new rowpublic boolean usesIndex(Index index)
Constraint
usesIndex
in class Constraint
index
- the indexpublic void setIndexOwner(Index index)
Constraint
setIndexOwner
in class Constraint
index
- the indexpublic HashSet<Column> getReferencedColumns(Table table)
Constraint
getReferencedColumns
in class Constraint
table
- the tablepublic Expression getExpression()
public boolean isBefore()
Constraint
isBefore
in class Constraint
public void checkExistingData(Session session)
Constraint
checkExistingData
in class Constraint
session
- the sessionpublic Index getUniqueIndex()
Constraint
getUniqueIndex
in class Constraint
public void rebuild()
Constraint
rebuild
in class Constraint
public boolean isEverything(ExpressionVisitor visitor)
Constraint
isEverything
in class Constraint
visitor
- the visitorCopyright © 2012 JBoss by Red Hat. All Rights Reserved.