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

public Class ColumnDefinitionNode

extends TableElementNode
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.compile.ModifyColumnNode
Imports
java.sql.Types, java.util.List, org.apache.derby.catalog.DefaultInfo, .UUID, org.apache.derby.catalog.types.DefaultInfoImpl, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.Limits, .SQLState, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.io.StoredFormatIds, org.apache.derby.iapi.services.loader.ClassInspector, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.compile.CompilerContext, org.apache.derby.iapi.sql.depend.ProviderList, org.apache.derby.iapi.sql.dictionary.DataDictionary, .TableDescriptor, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor, .StringDataValue, .TypeId, org.apache.derby.impl.sql.execute.ColumnInfo

A ColumnDefinitionNode represents a column definition in a DDL statement. There will be a ColumnDefinitionNode for each column in a CREATE TABLE statement, and for the column in an ALTER TABLE ADD COLUMN statement.

Field Summary

Modifier and TypeField and Description
pack-priv long
pack-priv boolean
pack-priv long
pack-priv long
pack-priv boolean
public static final int
pack-priv DefaultInfoImpl
pack-priv DefaultNode
pack-priv DataValueDescriptor
pack-priv GenerationClauseNode
pack-priv boolean
pack-priv boolean
public static final int
public static final int
public static final int
public static final int
pack-priv DataTypeDescriptor
type

The data type of this column.

Inherited from org.apache.derby.impl.sql.compile.TableElementNode:
AT_ADD_CHECK_CONSTRAINTAT_ADD_FOREIGN_KEY_CONSTRAINTAT_ADD_PRIMARY_KEY_CONSTRAINTAT_ADD_UNIQUE_CONSTRAINTAT_DROP_COLUMNAT_DROP_CONSTRAINTAT_MODIFY_COLUMNAT_MODIFY_CONSTRAINTAT_UNKNOWNelementTypename

Constructor Summary

AccessConstructor and Description
pack-priv
ColumnDefinitionNode(String
The name of the column
name
,
ValueNode
The default value of the column
defaultNode
,
DataTypeDescriptor
A DataTypeServices telling the type of the column
dataTypeServices
,
long[]
Info for auto-increment columns
autoIncrementInfo
,
ContextManager
The context manager
cm
)

Constructor for a ColumnDefinitionNode

Method Summary

Modifier and TypeMethod and Description
private void
autoincrementCheckRange(long minValue, long maxValue, String typeName)

checks to see if autoincrementIncrement and autoincrementInitial are within the bounds of the type whose min and max values are passed into this routine.

pack-priv void
bindAndValidateDefault(DataDictionary
The DataDictionary.
dd
,
TableDescriptor
The TableDescriptor.
td
)

Check the validity of the default, if any, for this node.

pack-priv void
checkUserType(TableDescriptor td)

Check the validity of a user type.

protected static DefaultInfoImpl
pack-priv boolean

Returns:

True if the defaultNode abides by the restrictions imposed by DB2 on default constants; false otherwise.
defaultTypeIsValid
(TypeId
TypeId of the target column.
columnType
,
DataTypeDescriptor
Description of the type of the target column.
columnDesc
,
TypeId
TypeId of the default node.
defaultType
,
ValueNode
Parsed ValueNode for the default value.
defaultNode
,
String
Unparsed default value (as entered by user).
defaultText
)

Check the validity of the default for this node

pack-priv int

Returns:

The action associated with this node.
getAction
()

Get the action associated with this node.

pack-priv long

Returns:

ColumnDefinitionNode.CREATE_AUTOINCREMENT - if this definition is for autoincrement column creatoin ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE - if this definition is for alter sutoincrement column to change the start value ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE if this definition is for alter autoincrement column to change the increment value
getAutoinc_create_or_modify_Start_Increment
()

Get the status of this autoincrement column

pack-priv boolean

Returns:

Autoincrement cycle value.
getAutoincrementCycle
()

Get the autoincrement cycle value

pack-priv long

Returns:

Autoincrement increment value.
getAutoincrementIncrement
()

Get the autoincrement increment value

pack-priv long

Returns:

Autoincrement start value.
getAutoincrementStart
()

Get the autoincrement start value

pack-priv String

Returns:

the name of the column
getColumnName
()

Returns the unqualified name of the column being defined.

pack-priv DefaultInfo

Returns:

The default info for the column
getDefaultInfo
()

Return the DefaultInfo containing the default information for this column

pack-priv DefaultNode

Returns:

The DefaultNode, if any, associated with this node.
getDefaultNode
()

Return the DefaultNode, if any, associated with this node.

pack-priv DataValueDescriptor

Returns:

The default value of the column
getDefaultValue
()

Return the DataValueDescriptor containing the default value for this column

pack-priv GenerationClauseNode
getGenerationClauseNode()

Get the generation clause.

pack-priv UUID

Returns:

The UUID of the old column default.
getOldDefaultUUID
()

Get the UUID of the old column default.

pack-priv final DataTypeDescriptor

Returns:

the data type of the column
getType
()

Returns the data type of the column being defined.

public boolean
hasGenerationClause()

Return true if this column has a generation clause.

pack-priv boolean

Returns:

Whether or not this is an autoincrement column.
isAutoincrementColumn
()

Is this an autoincrement column?

pack-priv void
printSubNodes(int
The depth of this node in the tree
depth
)

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.printSubNodes.

Prints the sub-nodes of this object.

pack-priv void
setCollationType(int collationType)

Set the collation type, note derivation is always implicit for any catalog item.

public void
setDefaultInfo(DefaultInfoImpl dii)

Set the generation clause (Default) bound to this column.

pack-priv final void
setNullability(boolean nullable)

Set the nullability of the column definition node.

public void
setType(DataTypeDescriptor dts)

Set the type of this column

public String

Returns:

This object as a String
toString
()

Overrides org.apache.derby.impl.sql.compile.TableElementNode.toString.

Convert this object to a String.

pack-priv void
validateAutoincrement(DataDictionary
DataDictionary.
dd
,
TableDescriptor
table descriptor.
td
,
int
base table or declared global temporary table.
tableType
)

Check the validity of the autoincrement values for this node.

pack-priv void
validateDefault(DataDictionary dd, TableDescriptor
The TableDescriptor.
td
)

Check the validity of the default for this node.

Inherited from org.apache.derby.impl.sql.compile.TableElementNode:
getElementTypegetNamehasCheckConstrainthasConstrainthasForeignKeyConstrainthasPrimaryKeyConstrainthasUniqueKeyConstraint

Field Detail

autoinc_create_or_modify_Start_Incrementback to summary
pack-priv long autoinc_create_or_modify_Start_Increment
autoincrementCycleback to summary
pack-priv boolean autoincrementCycle
autoincrementIncrementback to summary
pack-priv long autoincrementIncrement
autoincrementStartback to summary
pack-priv long autoincrementStart
autoincrementVerifyback to summary
pack-priv boolean autoincrementVerify
CREATE_AUTOINCREMENTback to summary
public static final int CREATE_AUTOINCREMENT
defaultInfoback to summary
pack-priv DefaultInfoImpl defaultInfo
defaultNodeback to summary
pack-priv DefaultNode defaultNode
defaultValueback to summary
pack-priv DataValueDescriptor defaultValue
generationClauseNodeback to summary
pack-priv GenerationClauseNode generationClauseNode
isAutoincrementback to summary
pack-priv boolean isAutoincrement
keepCurrentDefaultback to summary
pack-priv boolean keepCurrentDefault
MODIFY_AUTOINCREMENT_ALWAYS_VS_DEFAULTback to summary
public static final int MODIFY_AUTOINCREMENT_ALWAYS_VS_DEFAULT
MODIFY_AUTOINCREMENT_CYCLE_VALUEback to summary
public static final int MODIFY_AUTOINCREMENT_CYCLE_VALUE
MODIFY_AUTOINCREMENT_INC_VALUEback to summary
public static final int MODIFY_AUTOINCREMENT_INC_VALUE
MODIFY_AUTOINCREMENT_RESTART_VALUEback to summary
public static final int MODIFY_AUTOINCREMENT_RESTART_VALUE
typeback to summary
pack-priv DataTypeDescriptor type

The data type of this column.

Constructor Detail

ColumnDefinitionNodeback to summary
pack-priv ColumnDefinitionNode(String name, ValueNode defaultNode, DataTypeDescriptor dataTypeServices, long[] autoIncrementInfo, ContextManager cm) throws StandardException

Constructor for a ColumnDefinitionNode

Parameters
name:String

The name of the column

defaultNode:ValueNode

The default value of the column

dataTypeServices:DataTypeDescriptor

A DataTypeServices telling the type of the column

autoIncrementInfo:long[]

Info for auto-increment columns

cm:ContextManager

The context manager

Method Detail

autoincrementCheckRangeback to summary
private void autoincrementCheckRange(long minValue, long maxValue, String typeName) throws StandardException

checks to see if autoincrementIncrement and autoincrementInitial are within the bounds of the type whose min and max values are passed into this routine.

bindAndValidateDefaultback to summary
pack-priv void bindAndValidateDefault(DataDictionary dd, TableDescriptor td) throws StandardException

Check the validity of the default, if any, for this node.

Parameters
dd:DataDictionary

The DataDictionary.

td:TableDescriptor

The TableDescriptor.

Exceptions
StandardException:
Thrown on error
checkUserTypeback to summary
pack-priv void checkUserType(TableDescriptor td) throws StandardException

Check the validity of a user type. Checks whether this column definition describes a user type that either doesn't exist or is inaccessible, or that doesn't implement Serializable.

Exceptions
StandardException:
Thrown on error
createDefaultInfoOfAutoIncback to summary
protected static DefaultInfoImpl createDefaultInfoOfAutoInc()
defaultTypeIsValidback to summary
pack-priv boolean defaultTypeIsValid(TypeId columnType, DataTypeDescriptor columnDesc, TypeId defaultType, ValueNode defaultNode, String defaultText) throws StandardException

Check the validity of the default for this node

Parameters
columnType:TypeId

TypeId of the target column.

columnDesc:DataTypeDescriptor

Description of the type of the target column.

defaultType:TypeId

TypeId of the default node.

defaultNode:ValueNode

Parsed ValueNode for the default value.

defaultText:String

Unparsed default value (as entered by user).

Returns:boolean

True if the defaultNode abides by the restrictions imposed by DB2 on default constants; false otherwise.

getActionback to summary
pack-priv int getAction()

Get the action associated with this node.

Returns:int

The action associated with this node.

getAutoinc_create_or_modify_Start_Incrementback to summary
pack-priv long getAutoinc_create_or_modify_Start_Increment()

Get the status of this autoincrement column

Returns:long

ColumnDefinitionNode.CREATE_AUTOINCREMENT - if this definition is for autoincrement column creatoin ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE - if this definition is for alter sutoincrement column to change the start value ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE if this definition is for alter autoincrement column to change the increment value

getAutoincrementCycleback to summary
pack-priv boolean getAutoincrementCycle()

Get the autoincrement cycle value

Returns:boolean

Autoincrement cycle value.

getAutoincrementIncrementback to summary
pack-priv long getAutoincrementIncrement()

Get the autoincrement increment value

Returns:long

Autoincrement increment value.

getAutoincrementStartback to summary
pack-priv long getAutoincrementStart()

Get the autoincrement start value

Returns:long

Autoincrement start value.

getColumnNameback to summary
pack-priv String getColumnName()

Returns the unqualified name of the column being defined.

Returns:String

the name of the column

getDefaultInfoback to summary
pack-priv DefaultInfo getDefaultInfo()

Return the DefaultInfo containing the default information for this column

Returns:DefaultInfo

The default info for the column

getDefaultNodeback to summary
pack-priv DefaultNode getDefaultNode()

Return the DefaultNode, if any, associated with this node.

Returns:DefaultNode

The DefaultNode, if any, associated with this node.

getDefaultValueback to summary
pack-priv DataValueDescriptor getDefaultValue()

Return the DataValueDescriptor containing the default value for this column

Returns:DataValueDescriptor

The default value of the column

getGenerationClauseNodeback to summary
pack-priv GenerationClauseNode getGenerationClauseNode()

Get the generation clause.

getOldDefaultUUIDback to summary
pack-priv UUID getOldDefaultUUID()

Get the UUID of the old column default.

Returns:UUID

The UUID of the old column default.

getTypeback to summary
pack-priv final DataTypeDescriptor getType()

Returns the data type of the column being defined.

Returns:DataTypeDescriptor

the data type of the column

hasGenerationClauseback to summary
public boolean hasGenerationClause()

Return true if this column has a generation clause.

isAutoincrementColumnback to summary
pack-priv boolean isAutoincrementColumn()

Is this an autoincrement column?

Returns:boolean

Whether or not this is an autoincrement column.

printSubNodesback to summary
pack-priv void printSubNodes(int depth)

Overrides org.apache.derby.impl.sql.compile.QueryTreeNode.printSubNodes.

Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Parameters
depth:int

The depth of this node in the tree

Annotations
@Override
setCollationTypeback to summary
pack-priv void setCollationType(int collationType)

Set the collation type, note derivation is always implicit for any catalog item.

setDefaultInfoback to summary
public void setDefaultInfo(DefaultInfoImpl dii)

Set the generation clause (Default) bound to this column.

setNullabilityback to summary
pack-priv final void setNullability(boolean nullable)

Set the nullability of the column definition node.

setTypeback to summary
public void setType(DataTypeDescriptor dts)

Set the type of this column

toStringback to summary
public String toString()

Overrides org.apache.derby.impl.sql.compile.TableElementNode.toString.

Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Returns:String

This object as a String

Annotations
@Override
validateAutoincrementback to summary
pack-priv void validateAutoincrement(DataDictionary dd, TableDescriptor td, int tableType) throws StandardException

Check the validity of the autoincrement values for this node. The following errors are thrown by this routine. 1. 42z21 Invalid Increment; i.e 0. 2. 42z22 Invalid Type; autoincrement created on a non-exact-numeric type 3. 42995 The requested function does not apply to global temporary tables

Parameters
dd:DataDictionary

DataDictionary.

td:TableDescriptor

table descriptor.

tableType:int

base table or declared global temporary table.

Exceptions
StandardException:
if autoincrement default is incorrect; i.e if increment is 0 or if initial or increment values are out of range for the datatype.
validateDefaultback to summary
pack-priv void validateDefault(DataDictionary dd, TableDescriptor td) throws StandardException

Check the validity of the default for this node.

Parameters
td:TableDescriptor

The TableDescriptor.

Exceptions
StandardException:
Thrown on error