Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

public Class CreateConstraintConstantAction

extends ConstraintConstantAction
Class Inheritance
Imports
org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.catalog.UUID, org.apache.derby.iapi.services.uuid.UUIDFactory, org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.iapi.sql.dictionary.DDUtils, .ColumnDescriptor, .ConglomerateDescriptor, .ConstraintDescriptor, .DataDescriptorGenerator, .DataDictionary, .ForeignKeyConstraintDescriptor, .ReferencedKeyConstraintDescriptor, .SchemaDescriptor, .TableDescriptor, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.sql.depend.DependencyManager, .Provider, .ProviderInfo, org.apache.derby.iapi.sql.execute.ConstantAction, org.apache.derby.iapi.sql.Activation, org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.services.loader.ClassFactory, org.apache.derby.iapi.services.property.PropertyUtil, org.apache.derby.impl.sql.compile.ConstraintDefinitionNode

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

Field Summary

Modifier and TypeField and Description
private ClassFactory
private boolean[]
private String[]
private String
private boolean
private final boolean
private ConstraintInfo
private ProviderInfo[]
Inherited from org.apache.derby.impl.sql.execute.ConstraintConstantAction:
constraintIdconstraintNameconstraintTypeindexActionschemaIdschemaNametableName

Constructor Summary

AccessConstructor and Description
pack-priv
CreateConstraintConstantAction(String
Constraint name.
constraintName
,
int
Constraint type.
constraintType
,
boolean[]
Constraint characteristics
characteristics
,
boolean
Constraint is being added for a CREATE TABLE
forCreateTable
,
String
Table name.
tableName
,
UUID
UUID of table.
tableId
,
String
the schema that table and constraint lives in.
schemaName
,
String[]
String[] for column names
columnNames
,
IndexConstantAction
IndexConstantAction for constraint (if necessary)
indexAction
,
String
Text for check constraint
constraintText
,
ConstraintInfo
information about the constraint that this references
otherConstraint
,
ProviderInfo[]
Information on all the Providers
providerInfo
)

Make one of these puppies.

Method Summary

Modifier and TypeMethod and Description
public void
executeConstantAction(Activation
The execution environment for this constant action.
activation
)

Implements org.apache.derby.iapi.sql.execute.ConstantAction.executeConstantAction.

This is the guts of the Execution-time logic for CREATE CONSTRAINT.

private int[]

Returns:

int[] The column positions.
genColumnPositions
(TableDescriptor
The TableDescriptor for the table in question
td
,
boolean
true for primaryKey and unique constraints
columnsMustBeOrderable
)

Generate an array of column positions for the column list in the constraint.

pack-priv String

Returns:

constraint text
getConstraintText
()

Get the text defining this constraint.

pack-priv boolean

Returns:

true/false
isForeignKeyConstraint
()

Is the constant action for a foreign key

pack-priv boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.apache.derby.impl.sql.execute.ConstraintConstantAction:
getConstraintIdgetConstraintNamegetConstraintTypegetIndexActionvalidateConstraintvalidateFKConstraint

Field Detail

cfback to summary
private ClassFactory cf
characteristicsback to summary
private boolean[] characteristics
columnNamesback to summary
private String[] columnNames
constraintTextback to summary
private String constraintText
enabledback to summary
private boolean enabled
forCreateTableback to summary
private final boolean forCreateTable
otherConstraintInfoback to summary
private ConstraintInfo otherConstraintInfo
providerInfoback to summary
private ProviderInfo[] providerInfo

Constructor Detail

CreateConstraintConstantActionback to summary
pack-priv 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:String

Constraint name.

constraintType:int

Constraint type.

characteristics:boolean[]

Constraint characteristics

forCreateTable:boolean

Constraint is being added for a CREATE TABLE

tableName:String

Table name.

tableId:UUID

UUID of table.

schemaName:String

the schema that table and constraint lives in.

columnNames:String[]

String[] for column names

indexAction:IndexConstantAction

IndexConstantAction for constraint (if necessary)

constraintText:String

Text for check constraint

otherConstraint:ConstraintInfo

information about the constraint that this references

providerInfo:ProviderInfo[]

Information on all the Providers

Method Detail

executeConstantActionback to summary
public void executeConstantAction(Activation activation) throws StandardException

Implements org.apache.derby.iapi.sql.execute.ConstantAction.executeConstantAction.

This is the guts of the Execution-time logic for CREATE CONSTRAINT.

A constraint is represented as:

  • ConstraintDescriptor.
If a backing index is required then the index will be created through an CreateIndexConstantAction setup by the compiler.
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:Activation

Doc from org.apache.derby.iapi.sql.execute.ConstantAction.executeConstantAction.

The execution environment for this constant action.

Exceptions
StandardException:
Thrown on failure
See Also
ConstraintDescriptor, CreateIndexConstantAction, ConstantAction#executeConstantAction
genColumnPositionsback to summary
private int[] genColumnPositions(TableDescriptor td, boolean columnsMustBeOrderable) throws StandardException

Generate an array of column positions for the column list in the constraint.

Parameters
td:TableDescriptor

The TableDescriptor for the table in question

columnsMustBeOrderable:boolean

true for primaryKey and unique constraints

Returns:int[]

int[] The column positions.

getConstraintTextback to summary
pack-priv String getConstraintText()

Get the text defining this constraint.

Returns:String

constraint text

isForeignKeyConstraintback to summary
pack-priv boolean isForeignKeyConstraint()

Is the constant action for a foreign key

Returns:boolean

true/false

isInitiallyDeferredback to summary
pack-priv boolean isInitiallyDeferred()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object