Constraint

The base class for constraint checking.

Methods
void checkExistingData(Session session)
Check the existing data.
void checkExistingData(Session session)
Check the existing data. This method is called if the constraint is added after data has been inserted into the table.
Parameters:
session - the session
void checkRename()
void checkRename()
void checkRow(Session session, Table t, Row oldRow, Row newRow)
Check if this row fulfils the constraint.
void checkRow(Session session, Table t, Row oldRow, Row newRow)
Check if this row fulfils the constraint. This method throws an exception if not.
Parameters:
session - the session
t - the table
oldRow - the old row
newRow - the new row
int compareTo(Constraint other)
int compareTo(Constraint other)
Constraint.Type getConstraintType()
The constraint type name
Constraint.Type getConstraintType()
The constraint type name
Returns:
the name
String getCreateSQLWithoutIndexes()
Get the SQL statement to create this constraint.
String getCreateSQLWithoutIndexes()
Get the SQL statement to create this constraint.
Returns:
the SQL statement
String getDropSQL()
String getDropSQL()
Table getRefTable()
Table getRefTable()
HashSet getReferencedColumns(Table table)
Get all referenced columns.
HashSet getReferencedColumns(Table table)
Get all referenced columns.
Parameters:
table - the table
Returns:
the set of referenced columns
Table getTable()
Table getTable()
int getType()
int getType()
Index getUniqueIndex()
Get the unique index used to enforce this constraint, or null if no index is used.
Index getUniqueIndex()
Get the unique index used to enforce this constraint, or null if no index is used.
Returns:
the index
boolean isBefore()
Check if this constraint needs to be checked before updating the data.
boolean isBefore()
Check if this constraint needs to be checked before updating the data.
Returns:
true if it must be checked before updating
boolean isEverything(ExpressionVisitor visitor)
Visit all elements in the constraint.
boolean isEverything(ExpressionVisitor visitor)
Visit all elements in the constraint.
Parameters:
visitor - the visitor
Returns:
true if every visited expression returned true, or if there are no expressions
boolean isHidden()
boolean isHidden()
void rebuild()
This method is called after a related table has changed (the table was renamed, or columns have been renamed).
void rebuild()
This method is called after a related table has changed (the table was renamed, or columns have been renamed).
void setIndexOwner(Index index)
This index is now the owner of the specified index.
void setIndexOwner(Index index)
This index is now the owner of the specified index.
Parameters:
index - the index
boolean usesIndex(Index index)
Check if this constraint needs the specified index.
boolean usesIndex(Index index)
Check if this constraint needs the specified index.
Parameters:
index - the index
Returns:
true if the index is used