org.hsqldb
Class Constraint
- java.lang.Object
-
- org.hsqldb.Constraint
-
- All Implemented Interfaces:
- SchemaObject
public final class Constraint extends java.lang.Object implements SchemaObject
Implementation of a table constraint with references to the indexes used by the constraint.- Since:
- 1.6.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hsqldb.SchemaObject
SchemaObject.ConstraintTypes, SchemaObject.Deferable, SchemaObject.Nullability, SchemaObject.ParameterModes, SchemaObject.ReferentialAction, SchemaObject.ViewCheckModes
-
-
Field Summary
Fields Modifier and Type Field and Description static Constraint[]emptyArray-
Fields inherited from interface org.hsqldb.SchemaObject
ASSERTION, CATALOG, CHARSET, COLLATION, COLUMN, CONSTRAINT, CURSOR, DOMAIN, FUNCTION, GRANTEE, INDEX, LABEL, PARAMETER, PROCEDURE, ROUTINE, SCHEMA, SEARCH, SEQUENCE, SERVER, SPECIFIC_ROUTINE, SUBQUERY, TABLE, TRANSITION, TRIGGER, TYPE, VARIABLE, VIEW, WRAPPER
-
-
Constructor Summary
Constructors Constructor and Description Constraint(HsqlNameManager.HsqlName name, Constraint fkconstraint)Constructor for main constraints (foreign key references in PK table)Constraint(HsqlNameManager.HsqlName uniqueName, HsqlNameManager.HsqlName mainName, HsqlNameManager.HsqlName refName, Table mainTable, Table refTable, int[] mainCols, int[] refCols, Index mainIndex, Index refIndex, int deleteAction, int updateAction)Constraint(HsqlNameManager.HsqlName name, HsqlNameManager.HsqlName refTableName, OrderedHashSet refCols, HsqlNameManager.HsqlName mainTableName, OrderedHashSet mainCols, int type, int deleteAction, int updateAction, int matchType)General constructor for foreign key constraints.Constraint(HsqlNameManager.HsqlName name, OrderedHashSet mainCols, int type)Constraint(HsqlNameManager.HsqlName name, Table t, Index index, int type)Constructor declaration for PK and UNIQUEConstraint(HsqlNameManager.HsqlName name, Table table, int[] cols, int type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcompile(Session session, SchemaObject parentObject)HsqlNameManager.HsqlNamegetCatalogName()longgetChangeTimestamp()OrderedHashSetgetCheckColumnExpressions()ExpressiongetCheckExpression()java.lang.StringgetCheckSQL()Returns the SQL for the expression in CHECK clauseOrderedHashSetgetComponents()intgetConstraintType()Returns the type of constraintintgetDeferability()intgetDeleteAction()The ON DELETE triggered action of (foreign key) constraintjava.lang.StringgetDeleteActionString()HsqlExceptiongetException(java.lang.Object[] data)TablegetMain()Returns the main tableint[]getMainColumns()Returns the main table column index arrayHsqlNameManager.HsqlNamegetMainName()HsqlNameManager.HsqlNamegetMainTableName()HsqlNameManager.HsqlNamegetName()Returns the HsqlName.GranteegetOwner()TablegetRef()Returns the reference tableint[]getRefColumns()Returns the reference table column index arrayOrderedHashSetgetReferences()HsqlNameManager.HsqlNamegetRefName()HsqlNameManager.HsqlNamegetSchemaName()java.lang.StringgetSQL()intgetType()HsqlNameManager.HsqlNamegetUniqueName()intgetUpdateAction()The ON UPDATE triggered action of (foreign key) constraintjava.lang.StringgetUpdateActionString()booleanhasTriggeredAction()booleanisNotNull()Returns true if the expression in CHECK is a simple IS NOT NULL
-
-
-
Field Detail
-
emptyArray
public static final Constraint[] emptyArray
-
-
Constructor Detail
-
Constraint
public Constraint(HsqlNameManager.HsqlName name, Table t, Index index, int type)
Constructor declaration for PK and UNIQUE
-
Constraint
public Constraint(HsqlNameManager.HsqlName name, Table table, int[] cols, int type)
-
Constraint
public Constraint(HsqlNameManager.HsqlName name, Constraint fkconstraint)
Constructor for main constraints (foreign key references in PK table)
-
Constraint
public Constraint(HsqlNameManager.HsqlName name, HsqlNameManager.HsqlName refTableName, OrderedHashSet refCols, HsqlNameManager.HsqlName mainTableName, OrderedHashSet mainCols, int type, int deleteAction, int updateAction, int matchType)
General constructor for foreign key constraints.- Parameters:
name- name of constraintrefCols- list of referencing columnsmainTableName- referenced tablemainCols- list of referenced columnstype- constraint typedeleteAction- triggered action on deleteupdateAction- triggered action on update
-
Constraint
public Constraint(HsqlNameManager.HsqlName name, OrderedHashSet mainCols, int type)
-
Constraint
public Constraint(HsqlNameManager.HsqlName uniqueName, HsqlNameManager.HsqlName mainName, HsqlNameManager.HsqlName refName, Table mainTable, Table refTable, int[] mainCols, int[] refCols, Index mainIndex, Index refIndex, int deleteAction, int updateAction) throws HsqlException
- Throws:
HsqlException
-
-
Method Detail
-
getType
public int getType()
- Specified by:
getTypein interfaceSchemaObject
-
getName
public HsqlNameManager.HsqlName getName()
Returns the HsqlName.- Specified by:
getNamein interfaceSchemaObject
-
getCatalogName
public HsqlNameManager.HsqlName getCatalogName()
- Specified by:
getCatalogNamein interfaceSchemaObject
-
getSchemaName
public HsqlNameManager.HsqlName getSchemaName()
- Specified by:
getSchemaNamein interfaceSchemaObject
-
getOwner
public Grantee getOwner()
- Specified by:
getOwnerin interfaceSchemaObject
-
getReferences
public OrderedHashSet getReferences()
- Specified by:
getReferencesin interfaceSchemaObject
-
getComponents
public OrderedHashSet getComponents()
- Specified by:
getComponentsin interfaceSchemaObject
-
compile
public void compile(Session session, SchemaObject parentObject)
- Specified by:
compilein interfaceSchemaObject
-
getSQL
public java.lang.String getSQL()
- Specified by:
getSQLin interfaceSchemaObject
-
getChangeTimestamp
public long getChangeTimestamp()
- Specified by:
getChangeTimestampin interfaceSchemaObject
-
getMainTableName
public HsqlNameManager.HsqlName getMainTableName()
-
getMainName
public HsqlNameManager.HsqlName getMainName()
-
getRefName
public HsqlNameManager.HsqlName getRefName()
-
getUniqueName
public HsqlNameManager.HsqlName getUniqueName()
-
getConstraintType
public int getConstraintType()
Returns the type of constraint
-
getMain
public Table getMain()
Returns the main table
-
getRef
public Table getRef()
Returns the reference table
-
getDeleteAction
public int getDeleteAction()
The ON DELETE triggered action of (foreign key) constraint
-
getDeleteActionString
public java.lang.String getDeleteActionString()
-
getUpdateAction
public int getUpdateAction()
The ON UPDATE triggered action of (foreign key) constraint
-
getUpdateActionString
public java.lang.String getUpdateActionString()
-
hasTriggeredAction
public boolean hasTriggeredAction()
-
getDeferability
public int getDeferability()
-
getMainColumns
public int[] getMainColumns()
Returns the main table column index array
-
getRefColumns
public int[] getRefColumns()
Returns the reference table column index array
-
getCheckSQL
public java.lang.String getCheckSQL()
Returns the SQL for the expression in CHECK clause
-
isNotNull
public boolean isNotNull()
Returns true if the expression in CHECK is a simple IS NOT NULL
-
getException
public HsqlException getException(java.lang.Object[] data)
-
getCheckExpression
public Expression getCheckExpression()
-
getCheckColumnExpressions
public OrderedHashSet getCheckColumnExpressions()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG