org.apache.derby.impl.sql.execute
Class CreateConstraintConstantAction

java.lang.Object
  extended by org.apache.derby.impl.sql.execute.DDLConstantAction
      extended by org.apache.derby.impl.sql.execute.DDLSingleTableConstantAction
          extended by org.apache.derby.impl.sql.execute.ConstraintConstantAction
              extended by org.apache.derby.impl.sql.execute.CreateConstraintConstantAction
All Implemented Interfaces:
ConstantAction

public class CreateConstraintConstantAction
extends ConstraintConstantAction

This class describes actions that are ALWAYS performed for a constraint creation at Execution time.

Version:
0.1

Field Summary
private  ClassFactory cf
           
private  java.lang.String[] columnNames
           
private  java.lang.String constraintText
           
private  boolean enabled
           
private  boolean forCreateTable
           
private  ConstraintInfo otherConstraintInfo
           
private  ProviderInfo[] providerInfo
           
 
Fields inherited from class org.apache.derby.impl.sql.execute.ConstraintConstantAction
constraintName, constraintType, indexAction, schemaId, schemaName, tableName
 
Fields inherited from class org.apache.derby.impl.sql.execute.DDLSingleTableConstantAction
tableId
 
Constructor Summary
CreateConstraintConstantAction(java.lang.String constraintName, int constraintType, boolean forCreateTable, java.lang.String tableName, UUID tableId, java.lang.String schemaName, java.lang.String[] columnNames, IndexConstantAction indexAction, java.lang.String constraintText, boolean enabled, ConstraintInfo otherConstraint, ProviderInfo[] providerInfo)
          Make one of these puppies.
 
Method Summary
 void 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)  java.lang.String getConstraintText()
          Get the text defining this constraint.
(package private)  boolean isForeignKeyConstraint()
          Is the constant action for a foreign key
 java.lang.String toString()
           
 
Methods inherited from class org.apache.derby.impl.sql.execute.ConstraintConstantAction
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

forCreateTable

private final boolean forCreateTable

columnNames

private java.lang.String[] columnNames

constraintText

private java.lang.String constraintText

otherConstraintInfo

private ConstraintInfo otherConstraintInfo

cf

private ClassFactory cf

enabled

private boolean enabled

providerInfo

private ProviderInfo[] providerInfo
Constructor Detail

CreateConstraintConstantAction

CreateConstraintConstantAction(java.lang.String constraintName,
                               int constraintType,
                               boolean forCreateTable,
                               java.lang.String tableName,
                               UUID tableId,
                               java.lang.String schemaName,
                               java.lang.String[] columnNames,
                               IndexConstantAction indexAction,
                               java.lang.String constraintText,
                               boolean enabled,
                               ConstraintInfo otherConstraint,
                               ProviderInfo[] providerInfo)
Make one of these puppies.

Parameters:
constraintName - Constraint name.
constraintType - Constraint type.
forCreateTable - Constraint is being added for a CREATE TABLE
tableName - Table name.
tableId - UUID of table.
schemaName - the schema that table and constraint lives in.
columnNames - String[] for column names
indexAction - IndexConstantAction for constraint (if necessary)
constraintText - Text for check constraint RESOLVE - the next parameter should go away once we use UUIDs (Generated constraint names will be based off of uuids)
enabled - Should the constraint be created as enabled (enabled == true), or disabled (enabled == false).
otherConstraint - information about the constraint that this references
providerInfo - Information on all the Providers
Method Detail

executeConstantAction

public void executeConstantAction(Activation activation)
                           throws StandardException
This is the guts of the Execution-time logic for CREATE CONSTRAINT.

A constraint is represented as:

If a backing index is required then the index will be created through an CreateIndexConstantAction setup by the compiler.
Dependencies are created as:

Parameters:
activation - The execution environment for this constant action.
Throws:
StandardException - Thrown on failure
See Also:
ConstraintDescriptor, CreateIndexConstantAction, ConstantAction.executeConstantAction(org.apache.derby.iapi.sql.Activation)

isForeignKeyConstraint

boolean isForeignKeyConstraint()
Is the constant action for a foreign key

Returns:
true/false

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 question
columnsMustBeOrderable - true for primaryKey and unique constraints
Returns:
int[] The column positions.
Throws:
StandardException

getConstraintText

java.lang.String getConstraintText()
Get the text defining this constraint.

Returns:
constraint text

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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.