org.apache.derby.impl.sql.compile
Class ConstraintDefinitionNode

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.TableElementNode
          extended by org.apache.derby.impl.sql.compile.ConstraintDefinitionNode
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
FKConstraintDefinitionNode

public class ConstraintDefinitionNode
extends TableElementNode

A ConstraintDefintionNode is a class for all nodes that can represent constraint definitions.


Field Summary
(package private)  ProviderList apl
           
(package private)  java.lang.String backingIndexName
           
(package private)  UUID backingIndexUUID
           
private  int behavior
           
(package private)  int[] checkColumnReferences
           
(package private)  ValueNode checkCondition
           
(package private)  ResultColumnList columnList
           
private  TableName constraintName
           
(package private)  java.lang.String constraintText
           
protected  int constraintType
           
protected  java.util.Properties properties
           
(package private)  UUIDFactory uuidFactory
           
private  int verifyType
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.TableElementNode
AT_ADD_CHECK_CONSTRAINT, AT_ADD_FOREIGN_KEY_CONSTRAINT, AT_ADD_PRIMARY_KEY_CONSTRAINT, AT_ADD_UNIQUE_CONSTRAINT, AT_DROP_COLUMN, AT_DROP_CONSTRAINT, AT_MODIFY_COLUMN, AT_UNKNOWN, elementType, name
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
 
Constructor Summary
ConstraintDefinitionNode()
           
 
Method Summary
protected  void bind(DDLStatementNode ddlNode, DataDictionary dd)
          Bind this constraint definition.
 ProviderList getAuxiliaryProviderList()
          Return the auxiliary provider list.
(package private)  java.lang.String getBackingIndexName(DataDictionary dd)
          Gets a unique name for the backing index for this constraint of the form SQLyymmddhhmmssxxn yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second, xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value, n - number between 0-9
(package private)  UUID getBackingIndexUUID()
          Allocates a UUID if one doesn't already exist for the index backing this constraint.
 int[] getCheckColumnReferences()
          Get the array of 1-based column references for a check constraint.
 ValueNode getCheckCondition()
          Get the check condition from this table constraint.
 ResultColumnList getColumnList()
          Get the column list from this node.
(package private)  java.lang.String getConstraintMoniker()
          Get the name of the constraint.
 java.lang.String getConstraintText()
          Get the text of the constraint.
(package private)  int getConstraintType()
          Get the constraint type
(package private)  int getDropBehavior()
          Return the behavior of this constriant (DropStatementNode.xxx)
(package private)  java.lang.String getDropSchemaName()
          To support dropping exisiting constraints that may have mismatched schema names we need to support ALTER TABLE S1.T DROP CONSTRAINT S2.C.
 java.util.Properties getProperties()
          Get the optional properties for the backing index to this constraint.
 int getReferenceCount()
          Get the count of enabled fks that reference this constraint
private  UUIDFactory getUUIDFactory()
          Get the UUID factory
(package private)  int getVerifyType()
           
(package private)  boolean hasCheckConstraint()
          Does this element have a check constraint.
(package private)  boolean hasConstraint()
          Does this element have a constraint on it.
(package private)  boolean hasForeignKeyConstraint()
          Is this a foreign key constraint.
(package private)  boolean hasPrimaryKeyConstraint()
          Is this a primary key constraint.
(package private)  boolean hasUniqueKeyConstraint()
          Is this a unique key constraint.
 void init(java.lang.Object constraintName, java.lang.Object constraintType, java.lang.Object rcl, java.lang.Object properties, java.lang.Object checkCondition, java.lang.Object constraintText)
          Initialize a query tree node.
 void init(java.lang.Object constraintName, java.lang.Object constraintType, java.lang.Object rcl, java.lang.Object properties, java.lang.Object checkCondition, java.lang.Object constraintText, java.lang.Object behavior)
          Initialize a query tree node.
 void init(java.lang.Object constraintName, java.lang.Object constraintType, java.lang.Object rcl, java.lang.Object properties, java.lang.Object checkCondition, java.lang.Object constraintText, java.lang.Object behavior, java.lang.Object verifyType)
          Initialize a query tree node.
 boolean isEnabled()
          Is this constraint enabled.
 boolean isReferenced()
          Is this constraint referenced.
(package private)  boolean requiresBackingIndex()
          Is this a foreign key constraint.
(package private)  boolean requiresUniqueIndex()
          Is this a foreign key constraint.
(package private)  void setAuxiliaryProviderList(ProviderList apl)
          Set the auxiliary provider list.
 void setCheckColumnReferences(int[] checkColumnReferences)
          Set the array of 1-based column references for a check constraint.
 void setCheckCondition(ValueNode checkCondition)
          Set the check condition for this table constraint.
 void setColumnList(ResultColumnList columnList)
          Set the column list for this node.
 void setProperties(java.util.Properties properties)
          Set the optional properties for the backing index to this constraint.
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.TableElementNode
getElementType, getName, init, init
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, acceptChildren, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constraintName

private TableName constraintName

constraintType

protected int constraintType

properties

protected java.util.Properties properties

apl

ProviderList apl

uuidFactory

UUIDFactory uuidFactory

backingIndexName

java.lang.String backingIndexName

backingIndexUUID

UUID backingIndexUUID

checkColumnReferences

int[] checkColumnReferences

columnList

ResultColumnList columnList

constraintText

java.lang.String constraintText

checkCondition

ValueNode checkCondition

behavior

private int behavior

verifyType

private int verifyType
Constructor Detail

ConstraintDefinitionNode

public ConstraintDefinitionNode()
Method Detail

init

public void init(java.lang.Object constraintName,
                 java.lang.Object constraintType,
                 java.lang.Object rcl,
                 java.lang.Object properties,
                 java.lang.Object checkCondition,
                 java.lang.Object constraintText,
                 java.lang.Object behavior)
Description copied from class: QueryTreeNode
Initialize a query tree node.

Overrides:
init in class QueryTreeNode

init

public void init(java.lang.Object constraintName,
                 java.lang.Object constraintType,
                 java.lang.Object rcl,
                 java.lang.Object properties,
                 java.lang.Object checkCondition,
                 java.lang.Object constraintText)
Description copied from class: QueryTreeNode
Initialize a query tree node.

Overrides:
init in class QueryTreeNode

init

public void init(java.lang.Object constraintName,
                 java.lang.Object constraintType,
                 java.lang.Object rcl,
                 java.lang.Object properties,
                 java.lang.Object checkCondition,
                 java.lang.Object constraintText,
                 java.lang.Object behavior,
                 java.lang.Object verifyType)
Description copied from class: QueryTreeNode
Initialize a query tree node.

Overrides:
init in class QueryTreeNode

toString

public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Overrides:
toString in class TableElementNode
Returns:
This object as a String

bind

protected void bind(DDLStatementNode ddlNode,
                    DataDictionary dd)
             throws StandardException
Bind this constraint definition.

Parameters:
ddlNode - the create or alter table node
dd - the dd
Throws:
StandardException - on error

getConstraintMoniker

java.lang.String getConstraintMoniker()
Get the name of the constraint. If the user didn't provide one, we make one up. This allows Replication to agree with the core compiler on the names of constraints.

Returns:
constraint name

getDropSchemaName

java.lang.String getDropSchemaName()
To support dropping exisiting constraints that may have mismatched schema names we need to support ALTER TABLE S1.T DROP CONSTRAINT S2.C. If a constraint name was specified this returns it, otherwise it returns null.


getBackingIndexUUID

UUID getBackingIndexUUID()
Allocates a UUID if one doesn't already exist for the index backing this constraint. This allows Replication logic to agree with the core compiler on what the UUIDs of indices are.

Returns:
a UUID for the constraint. allocates one if this is the first time this method is called.

getBackingIndexName

java.lang.String getBackingIndexName(DataDictionary dd)
Gets a unique name for the backing index for this constraint of the form SQLyymmddhhmmssxxn yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second, xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value, n - number between 0-9

Returns:
name of backing index

setAuxiliaryProviderList

void setAuxiliaryProviderList(ProviderList apl)
Set the auxiliary provider list.

Parameters:
apl - The new auxiliary provider list.

getAuxiliaryProviderList

public ProviderList getAuxiliaryProviderList()
Return the auxiliary provider list.

Returns:
The auxiliary provider list.

hasPrimaryKeyConstraint

boolean hasPrimaryKeyConstraint()
Is this a primary key constraint.

Overrides:
hasPrimaryKeyConstraint in class TableElementNode
Returns:
boolean Whether or not this is a primary key constraint

hasUniqueKeyConstraint

boolean hasUniqueKeyConstraint()
Is this a unique key constraint.

Overrides:
hasUniqueKeyConstraint in class TableElementNode
Returns:
boolean Whether or not this is a unique key constraint

hasForeignKeyConstraint

boolean hasForeignKeyConstraint()
Is this a foreign key constraint.

Overrides:
hasForeignKeyConstraint in class TableElementNode
Returns:
boolean Whether or not this is a unique key constraint

hasCheckConstraint

boolean hasCheckConstraint()
Does this element have a check constraint.

Overrides:
hasCheckConstraint in class TableElementNode
Returns:
boolean Whether or not this element has a check constraint

hasConstraint

boolean hasConstraint()
Does this element have a constraint on it.

Overrides:
hasConstraint in class TableElementNode
Returns:
boolean Whether or not this element has a constraint on it

requiresBackingIndex

boolean requiresBackingIndex()
Is this a foreign key constraint.

Returns:
boolean Whether or not this is a unique key constraint

requiresUniqueIndex

boolean requiresUniqueIndex()
Is this a foreign key constraint.

Returns:
boolean Whether or not this is a unique key constraint

getConstraintType

int getConstraintType()
Get the constraint type

Returns:
constraintType The constraint type.

setProperties

public void setProperties(java.util.Properties properties)
Set the optional properties for the backing index to this constraint.

Parameters:
properties - The optional Properties for this constraint.

getProperties

public java.util.Properties getProperties()
Get the optional properties for the backing index to this constraint.

Returns:
The optional properties for the backing index to this constraint

isReferenced

public boolean isReferenced()
Is this constraint referenced.

Returns:
true/false

getReferenceCount

public int getReferenceCount()
Get the count of enabled fks that reference this constraint

Returns:
the number

isEnabled

public boolean isEnabled()
Is this constraint enabled.

Returns:
true/false

getColumnList

public ResultColumnList getColumnList()
Get the column list from this node.

Returns:
ResultColumnList The column list from this table constraint.

setColumnList

public void setColumnList(ResultColumnList columnList)
Set the column list for this node. This is useful for check constraints where the list of referenced columns is built at bind time.

Parameters:
columnList - The new columnList.

getCheckCondition

public ValueNode getCheckCondition()
Get the check condition from this table constraint.

Returns:
The check condition from this node.

setCheckCondition

public void setCheckCondition(ValueNode checkCondition)
Set the check condition for this table constraint.

Parameters:
checkCondition - The check condition

getConstraintText

public java.lang.String getConstraintText()
Get the text of the constraint. (Only meaningful for check constraints.)

Returns:
The constraint text.

getCheckColumnReferences

public int[] getCheckColumnReferences()
Get the array of 1-based column references for a check constraint.

Returns:
The array of 1-based column references for a check constraint.

setCheckColumnReferences

public void setCheckColumnReferences(int[] checkColumnReferences)
Set the array of 1-based column references for a check constraint.

Parameters:
checkColumnReferences - The array of 1-based column references for the check constraint.

getDropBehavior

int getDropBehavior()
Return the behavior of this constriant (DropStatementNode.xxx)

Returns:
the behavior

getVerifyType

int getVerifyType()
Returns:
the expected type of the constraint, DataDictionary.DROP_CONSTRAINT if the constraint is to be dropped without checking its type.

getUUIDFactory

private UUIDFactory getUUIDFactory()
Get the UUID factory

Returns:
the UUID factory

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.