Class CreateConstraintConstantAction
java.lang.Object
org.apache.derby.impl.sql.execute.DDLConstantAction
org.apache.derby.impl.sql.execute.DDLSingleTableConstantAction
org.apache.derby.impl.sql.execute.ConstraintConstantAction
org.apache.derby.impl.sql.execute.CreateConstraintConstantAction
- All Implemented Interfaces:
ConstantAction
This class describes actions that are ALWAYS performed for a
constraint creation at Execution time.
- Version:
- 0.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClassFactory
private boolean[]
private String[]
private String
private boolean
private final boolean
private ConstraintInfo
private ProviderInfo[]
Fields inherited from class org.apache.derby.impl.sql.execute.ConstraintConstantAction
constraintId, constraintName, constraintType, indexAction, schemaId, schemaName, tableName
Fields inherited from class org.apache.derby.impl.sql.execute.DDLSingleTableConstantAction
tableId
Fields inherited from interface org.apache.derby.iapi.sql.execute.ConstantAction
WHEN_MATCHED_THEN_DELETE, WHEN_MATCHED_THEN_UPDATE, WHEN_NOT_MATCHED_THEN_INSERT
-
Constructor Summary
ConstructorsConstructorDescriptionCreateConstraintConstantAction
(String constraintName, int constraintType, boolean[] characteristics, boolean forCreateTable, String tableName, UUID tableId, String schemaName, String[] columnNames, IndexConstantAction indexAction, String constraintText, ConstraintInfo otherConstraint, ProviderInfo[] providerInfo) Make one of these puppies. -
Method Summary
Modifier and TypeMethodDescriptionvoid
executeConstantAction
(Activation activation) This is the guts of the Execution-time logic for CREATE CONSTRAINT.private int[]
genColumnPositions
(TableDescriptor td, boolean columnsMustBeOrderable) Generate an array of column positions for the column list in the constraint.(package private) String
Get the text defining this constraint.(package private) boolean
Is the constant action for a foreign key(package private) boolean
toString()
Methods inherited from class org.apache.derby.impl.sql.execute.ConstraintConstantAction
getConstraintId, getConstraintName, getConstraintType, getIndexAction, validateConstraint, validateFKConstraint
Methods inherited from class org.apache.derby.impl.sql.execute.DDLSingleTableConstantAction
dropConglomerate, dropConglomerate, dropConstraint, dropConstraint, dropConstraint, executeConglomReplacement, getConglomReplacementAction, recreateUniqueConstraintBackingIndexAsUniqueWhenNotNull
Methods inherited from class org.apache.derby.impl.sql.execute.DDLConstantAction
addColumnDependencies, adjustUDTDependencies, adjustUDTDependencies, constructToString, getAndCheckSchemaDescriptor, getSchemaDescriptorForCreate, lockTableForDDL, storeConstraintDependenciesOnPrivileges, storeViewTriggerDependenciesOnPrivileges
-
Field Details
-
forCreateTable
private final boolean forCreateTable -
columnNames
-
constraintText
-
otherConstraintInfo
-
cf
-
enabled
private boolean enabled -
characteristics
private boolean[] characteristics -
providerInfo
-
-
Constructor Details
-
CreateConstraintConstantAction
CreateConstraintConstantAction(String constraintName, int constraintType, boolean[] characteristics, boolean forCreateTable, String tableName, UUID tableId, String schemaName, String[] columnNames, IndexConstantAction indexAction, String constraintText, ConstraintInfo otherConstraint, ProviderInfo[] providerInfo) Make one of these puppies.- Parameters:
constraintName
- Constraint name.constraintType
- Constraint type.characteristics
- Constraint characteristicsforCreateTable
- Constraint is being added for a CREATE TABLEtableName
- Table name.tableId
- UUID of table.schemaName
- the schema that table and constraint lives in.columnNames
- String[] for column namesindexAction
- IndexConstantAction for constraint (if necessary)constraintText
- Text for check constraintotherConstraint
- information about the constraint that this referencesproviderInfo
- Information on all the Providers
-
-
Method Details
-
executeConstantAction
This is the guts of the Execution-time logic for CREATE CONSTRAINT.A constraint is represented as:
- ConstraintDescriptor.
Dependencies are created as:- ConstraintDescriptor depends on all the providers collected at compile time and passed into the constructor.
- For a FOREIGN KEY constraint ConstraintDescriptor depends on the ConstraintDescriptor for the referenced constraints and the privileges required to create the constraint.
- Parameters:
activation
- The execution environment for this constant action.- Throws:
StandardException
- Thrown on failure- See Also:
-
isForeignKeyConstraint
boolean isForeignKeyConstraint()Is the constant action for a foreign key- Returns:
- true/false
-
isInitiallyDeferred
boolean isInitiallyDeferred() -
genColumnPositions
private int[] genColumnPositions(TableDescriptor td, boolean columnsMustBeOrderable) throws StandardException Generate an array of column positions for the column list in the constraint.- Parameters:
td
- The TableDescriptor for the table in questioncolumnsMustBeOrderable
- true for primaryKey and unique constraints- Returns:
- int[] The column positions.
- Throws:
StandardException
-
getConstraintText
String getConstraintText()Get the text defining this constraint.- Returns:
- constraint text
-
toString
-