public final class Constraint extends java.lang.Object implements SchemaObject
Title: Dataspace Framework
Description: Dataspace underlying provider implementation
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
SchemaObject.ConstraintTypes, SchemaObject.Deferable, SchemaObject.Nullability, SchemaObject.ParameterModes, SchemaObject.ReferentialAction, SchemaObject.ViewCheckModes
Modifier and Type | Field and Description |
---|---|
com.streamscape.ds.parser.expression.Expression |
check |
int |
constType |
ConstraintCore |
core |
static Constraint[] |
emptyArray |
boolean |
isForward |
int |
notNullColumnIndex |
ACTOR, ASPECTS, ASSERTION, CATALOG, CHARSET, COLLATION, COLLECTION, COLUMN, CONNECTION_FACTORY, CONSTRAINT, CURSOR, DOMAIN, EVENT_PROTOTYPE, FACETS, FILE_DESCRIPTOR, FULL_TEXT_INDEX, FUNCTION, GRANTEE, INDEX, JOB, LABEL, PARAMETER, PROCEDURE, REFERENCE_LINK, REPLICA, REPLICATION_SOURCE, ROUTINE, SCHEMA, SEMANTIC_TYPE, SEQUENCE, SERVER, SPECIFIC_ROUTINE, SUBQUERY, TABLE, TIMER, TRANSIENT_VAR, TRANSITION, TRIGGER, TYPE, VARIABLE, VIEW, WRAPPER
Constructor and Description |
---|
Constraint(NameManager.ObjectName name,
Constraint fkconstraint)
Constructor for main constraints (foreign key references in PK table)
|
Constraint(NameManager.ObjectName uniqueName,
NameManager.ObjectName mainName,
NameManager.ObjectName refName,
Table mainTable,
Table refTable,
int[] mainCols,
int[] refCols,
com.streamscape.ds.persist.index.Index mainIndex,
com.streamscape.ds.persist.index.Index refIndex,
int deleteAction,
int updateAction) |
Constraint(NameManager.ObjectName name,
NameManager.ObjectName refTableName,
com.streamscape.ds.lib.OrderedHashSet refCols,
NameManager.ObjectName mainTableName,
com.streamscape.ds.lib.OrderedHashSet mainCols,
int type,
int deleteAction,
int updateAction,
int matchType)
General constructor for foreign key constraints.
|
Constraint(NameManager.ObjectName name,
com.streamscape.ds.lib.OrderedHashSet mainCols,
int type) |
Constraint(NameManager.ObjectName name,
Table t,
com.streamscape.ds.persist.index.Index index,
int type)
Constructor declaration for PK and UNIQUE
|
Constraint(NameManager.ObjectName name,
Table table,
int[] cols,
int type) |
Modifier and Type | Method and Description |
---|---|
void |
checkCheckConstraint(com.streamscape.ds.session.Session session,
Table table,
ColumnSchema column,
java.lang.Object data) |
void |
checkInsert(com.streamscape.ds.session.Session session,
Table table,
java.lang.Object[] data,
boolean isNew)
Checks for foreign key or check constraint violation when
inserting a row into the child table.
|
void |
checkReferencedRows(com.streamscape.ds.session.Session session,
Table table)
Check used before creating a new foreign key cosntraint, this method
checks all rows of a table to ensure they all have a corresponding
row in the main table.
|
void |
compile(com.streamscape.ds.session.Session session,
SchemaObject parentObject) |
Constraint |
duplicate() |
com.streamscape.ds.navigator.RowIterator |
findFkRef(com.streamscape.ds.session.Session session,
java.lang.Object[] row)
New method to find any referencing row for a foreign key (finds row in
child table).
|
NameManager.ObjectName |
getCatalogName() |
long |
getChangeTimestamp() |
com.streamscape.ds.lib.OrderedHashSet |
getCheckColumnExpressions() |
com.streamscape.ds.parser.expression.Expression |
getCheckExpression() |
java.lang.String |
getCheckSQL()
Returns the SQL for the expression in CHECK clause
|
com.streamscape.ds.lib.OrderedHashSet |
getComponents() |
int |
getConstraintType()
Returns the type of constraint
|
int |
getDeferability() |
int |
getDeleteAction()
The ON DELETE triggered action of (foreign key) constraint
|
java.lang.String |
getDeleteActionString() |
DataspaceException |
getException(java.lang.Object[] data) |
Table |
getMain()
Returns the main table
|
int[] |
getMainColumns()
Returns the main table column index array
|
com.streamscape.ds.persist.index.Index |
getMainIndex()
Returns the main index
|
NameManager.ObjectName |
getMainName() |
NameManager.ObjectName |
getMainTableName() |
NameManager.ObjectName |
getObjectName()
Returns the HsqlName.
|
int |
getObjectType() |
com.streamscape.ds.rights.Grantee |
getOwner() |
Table |
getRef()
Returns the reference table
|
int[] |
getRefColumns()
Returns the reference table column index array
|
com.streamscape.ds.lib.OrderedHashSet |
getReferences() |
com.streamscape.ds.persist.index.Index |
getRefIndex()
Returns the reference index
|
NameManager.ObjectName |
getRefName() |
NameManager.ObjectName |
getSchemaName() |
java.lang.String |
getSQL() |
java.lang.String |
getSQL(java.lang.String name) |
NameManager.ObjectName |
getUniqueName() |
int |
getUpdateAction()
The ON UPDATE triggered action of (foreign key) constraint
|
java.lang.String |
getUpdateActionString() |
boolean |
hasColumn(int colIndex) |
boolean |
hasColumnOnly(int colIndex) |
boolean |
hasColumnPlus(int colIndex) |
boolean |
hasTriggeredAction() |
boolean |
isEquivalent(Table mainTable,
int[] mainCols,
Table refTable,
int[] refCols)
Compares this with another constraint column set.
|
boolean |
isNotNull()
Returns true if the expression in CHECK is a simple IS NOT NULL
|
boolean |
isUniqueWithColumns(int[] cols)
Compares this with another constraint column set.
|
void |
prepareCheckConstraint(com.streamscape.ds.session.Session session,
Table table,
boolean checkValues) |
void |
setColumnsIndexes(Table table) |
void |
updateTable(com.streamscape.ds.session.Session session,
Table oldTable,
Table newTable,
int colIndex,
int adjust)
Used to update constrains to reflect structural changes in a table.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aggregateObjectStateHolder, getSQLInSchema, recompileObject
public ConstraintCore core
public int constType
public boolean isForward
public com.streamscape.ds.parser.expression.Expression check
public int notNullColumnIndex
public static final Constraint[] emptyArray
public Constraint(NameManager.ObjectName name, Table t, com.streamscape.ds.persist.index.Index index, int type)
public Constraint(NameManager.ObjectName name, Table table, int[] cols, int type)
public Constraint(NameManager.ObjectName name, Constraint fkconstraint)
public Constraint(NameManager.ObjectName name, NameManager.ObjectName refTableName, com.streamscape.ds.lib.OrderedHashSet refCols, NameManager.ObjectName mainTableName, com.streamscape.ds.lib.OrderedHashSet mainCols, int type, int deleteAction, int updateAction, int matchType)
name
- name of constraintrefCols
- list of referencing columnsmainTableName
- referenced tablemainCols
- list of referenced columnstype
- constraint typedeleteAction
- triggered action on deleteupdateAction
- triggered action on updatepublic Constraint(NameManager.ObjectName name, com.streamscape.ds.lib.OrderedHashSet mainCols, int type)
public Constraint(NameManager.ObjectName uniqueName, NameManager.ObjectName mainName, NameManager.ObjectName refName, Table mainTable, Table refTable, int[] mainCols, int[] refCols, com.streamscape.ds.persist.index.Index mainIndex, com.streamscape.ds.persist.index.Index refIndex, int deleteAction, int updateAction) throws DataspaceException
DataspaceException
public Constraint duplicate()
public void setColumnsIndexes(Table table)
public int getObjectType()
getObjectType
in interface SchemaObject
public NameManager.ObjectName getObjectName()
getObjectName
in interface SchemaObject
public NameManager.ObjectName getCatalogName()
getCatalogName
in interface SchemaObject
public NameManager.ObjectName getSchemaName()
getSchemaName
in interface SchemaObject
public com.streamscape.ds.rights.Grantee getOwner()
getOwner
in interface SchemaObject
public com.streamscape.ds.lib.OrderedHashSet getReferences()
getReferences
in interface SchemaObject
public com.streamscape.ds.lib.OrderedHashSet getComponents()
getComponents
in interface SchemaObject
public void compile(com.streamscape.ds.session.Session session, SchemaObject parentObject)
compile
in interface SchemaObject
public java.lang.String getSQL(java.lang.String name)
getSQL
in interface SchemaObject
public java.lang.String getSQL()
getSQL
in interface SchemaObject
public long getChangeTimestamp()
getChangeTimestamp
in interface SchemaObject
public NameManager.ObjectName getMainTableName()
public NameManager.ObjectName getMainName()
public NameManager.ObjectName getRefName()
public NameManager.ObjectName getUniqueName()
public int getConstraintType()
public Table getMain()
public com.streamscape.ds.persist.index.Index getMainIndex()
public Table getRef()
public com.streamscape.ds.persist.index.Index getRefIndex()
public int getDeleteAction()
public java.lang.String getDeleteActionString()
public int getUpdateAction()
public java.lang.String getUpdateActionString()
public boolean hasTriggeredAction()
public int getDeferability()
public int[] getMainColumns()
public int[] getRefColumns()
public java.lang.String getCheckSQL()
public boolean isNotNull()
public boolean hasColumnOnly(int colIndex)
public boolean hasColumnPlus(int colIndex)
public boolean hasColumn(int colIndex)
public boolean isUniqueWithColumns(int[] cols)
public boolean isEquivalent(Table mainTable, int[] mainCols, Table refTable, int[] refCols)
public void updateTable(com.streamscape.ds.session.Session session, Table oldTable, Table newTable, int colIndex, int adjust)
session
- SessionoldTable
- reference to the old version of the tablenewTable
- referenct to the new version of the tablecolIndex
- index at which table column is added or removedadjust
- -1, 0, +1 to indicate if column is added or removedpublic void checkInsert(com.streamscape.ds.session.Session session, Table table, java.lang.Object[] data, boolean isNew)
public void checkCheckConstraint(com.streamscape.ds.session.Session session, Table table, ColumnSchema column, java.lang.Object data)
public DataspaceException getException(java.lang.Object[] data)
public com.streamscape.ds.navigator.RowIterator findFkRef(com.streamscape.ds.session.Session session, java.lang.Object[] row)
session
- Sessionrow
- array of objects for a database rowpublic void checkReferencedRows(com.streamscape.ds.session.Session session, Table table)
public com.streamscape.ds.parser.expression.Expression getCheckExpression()
public com.streamscape.ds.lib.OrderedHashSet getCheckColumnExpressions()
public void prepareCheckConstraint(com.streamscape.ds.session.Session session, Table table, boolean checkValues)
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.