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

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.TableElementNode
          extended byorg.apache.derby.impl.sql.compile.ColumnDefinitionNode
              extended byorg.apache.derby.impl.sql.compile.ModifyColumnNode
All Implemented Interfaces:
Visitable

public class ModifyColumnNode
extends ColumnDefinitionNode

A ModifyColumnNode represents a modify column in an ALTER TABLE statement.

Author:
Jerry Brenner

Field Summary
(package private)  int columnPosition
           
(package private)  UUID oldDefaultUUID
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.ColumnDefinitionNode
autoincrementIncrement, autoincrementStart, autoincrementVerify, dataTypeServices, defaultInfo, defaultNode, defaultValue, isAutoincrement
 
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_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
ModifyColumnNode()
           
 
Method Summary
(package private)  void bindAndValidateDefault(DataDictionary dd, TableDescriptor td)
          Check the validity of the default, if any, for this node.
 void checkExistingConstraints(TableDescriptor td)
          If the type of a column is being changed (for mulan, the length of the column is being increased then make sure that this does not violate any key constraints; the column being altered is 1. part of foreign key constraint ==> ERROR.
 void checkUserType(TableDescriptor td)
          Check the validity of a user type.
(package private)  int getAction()
          Get the action associated with this node.
 int getColumnPosition()
          Get the column position for the column.
private  ColumnDescriptor getLocalColumnDescriptor(java.lang.String name, TableDescriptor td)
           
(package private)  UUID getOldDefaultUUID()
          Get the UUID of the old column default.
 void validateAutoincrement(DataDictionary dd, TableDescriptor td, int tableType)
          check the validity of autoincrement values in the case that we are modifying an existing column (includes checking if autoincrement is set when making a column nullable)
 
Methods inherited from class org.apache.derby.impl.sql.compile.ColumnDefinitionNode
defaultTypeIsValid, getAutoincrementIncrement, getAutoincrementStart, getColumnName, getDataTypeServices, getDefaultInfo, getDefaultNode, getDefaultValue, init, isAutoincrementColumn, toString, validateDefault
 
Methods inherited from class org.apache.derby.impl.sql.compile.TableElementNode
getElementType, getName, hasCheckConstraint, hasConstraint, hasForeignKeyConstraint, hasPrimaryKeyConstraint, hasUniqueKeyConstraint, init, init
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bind, convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generate, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

columnPosition

int columnPosition

oldDefaultUUID

UUID oldDefaultUUID
Constructor Detail

ModifyColumnNode

public ModifyColumnNode()
Method Detail

getOldDefaultUUID

UUID getOldDefaultUUID()
Get the UUID of the old column default.

Overrides:
getOldDefaultUUID in class ColumnDefinitionNode
Returns:
The UUID of the old column default.

getColumnPosition

public int getColumnPosition()
Get the column position for the column.

Returns:
The column position for the column.

checkUserType

public void checkUserType(TableDescriptor td)
                   throws StandardException
Check the validity of a user type. Checks that 1. the column type is either varchar, .... 2. is the same type after the alter. 3. length is greater than the old length.

Overrides:
checkUserType in class ColumnDefinitionNode
Returns:
Nothing
Throws:
StandardException - Thrown on error

checkExistingConstraints

public void checkExistingConstraints(TableDescriptor td)
                              throws StandardException
If the type of a column is being changed (for mulan, the length of the column is being increased then make sure that this does not violate any key constraints; the column being altered is 1. part of foreign key constraint ==> ERROR. This references a Primary Key constraint and the type & lengths of the pkey/fkey must match exactly. 2. part of a unique/primary key constraint ==> OK if no fkey references this constraint. ==> ERROR if any fkey in the system references this constraint.

Parameters:
td - The Table Descriptor on which the ALTER is being done.
Throws:
StandardException - Thrown on Error.

getAction

int getAction()
Get the action associated with this node.

Overrides:
getAction in class ColumnDefinitionNode
Returns:
The action associated with this node.

bindAndValidateDefault

void bindAndValidateDefault(DataDictionary dd,
                            TableDescriptor td)
                      throws StandardException
Check the validity of the default, if any, for this node.

Overrides:
bindAndValidateDefault in class ColumnDefinitionNode
Parameters:
dd - The DataDictionary.
td - The TableDescriptor.
Returns:
Nothing.
Throws:
StandardException - Thrown on error

getLocalColumnDescriptor

private ColumnDescriptor getLocalColumnDescriptor(java.lang.String name,
                                                  TableDescriptor td)
                                           throws StandardException
Throws:
StandardException

validateAutoincrement

public void validateAutoincrement(DataDictionary dd,
                                  TableDescriptor td,
                                  int tableType)
                           throws StandardException
check the validity of autoincrement values in the case that we are modifying an existing column (includes checking if autoincrement is set when making a column nullable)

Overrides:
validateAutoincrement in class ColumnDefinitionNode
Parameters:
dd - DataDictionary.
td - table descriptor.
tableType - base table or declared global temporary table.
Throws:
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.

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.