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

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.StatementNode
          extended by org.apache.derby.impl.sql.compile.DDLStatementNode
              extended by org.apache.derby.impl.sql.compile.AlterTableNode
All Implemented Interfaces:
Node, Visitable

public class AlterTableNode
extends DDLStatementNode

A AlterTableNode represents a DDL statement that alters a table. It contains the name of the object to be created.


Field Summary
 TableDescriptor baseTable
           
 int behavior
           
private  int changeType
           
protected  ColumnInfo[] colInfos
           
 boolean compressTable
           
protected  ConstraintConstantAction[] conActions
           
 boolean defragment
           
private  boolean dropStatistics
          dropStatistics will indicate that we are here for dropping the statistics.
private  boolean dropStatisticsAll
          The flag dropStatisticsAll will tell if we are going to drop the statistics of all indexes or just one index on a table.
private  java.lang.String indexNameForStatistics
          If statistic is getting updated/dropped for just one index, then indexNameForStatistics will tell the name of the specific index whose statistics need to be updated/dropped.
 char lockGranularity
           
protected  int numConstraints
           
 boolean purge
           
protected  SchemaDescriptor schemaDescriptor
           
 boolean sequential
           
 TableElementList tableElementList
           
 boolean truncateEndOfTable
           
private  boolean truncateTable
           
private  boolean updateStatistics
          updateStatistics will indicate that we are here for updating the statistics.
private  boolean updateStatisticsAll
          The flag updateStatisticsAll will tell if we are going to update the statistics of all indexes or just one index on a table.
 
Fields inherited from class org.apache.derby.impl.sql.compile.DDLStatementNode
ADD_TYPE, DROP_STATISTICS, DROP_TYPE, implicitCreateSchema, LOCKING_TYPE, MODIFY_TYPE, UNKNOWN_TYPE, UPDATE_STATISTICS
 
Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode
EMPTY_TD_LIST, NEED_CURSOR_ACTIVATION, NEED_DDL_ACTIVATION, NEED_NOTHING_ACTIVATION, NEED_PARAM_ACTIVATION, NEED_ROW_ACTIVATION
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
 
Constructor Summary
AlterTableNode()
           
 
Method Summary
(package private)  void acceptChildren(Visitor v)
          Accept the visitor for all visitable children of this node.
 void bindStatement()
          Bind this AlterTableNode.
 void genColumnInfo()
          Generate the ColumnInfo argument for the constant action.
 int getChangeType()
           
 void init(java.lang.Object objectName)
          Initializer for a TRUNCATE TABLE
 void init(java.lang.Object objectName, java.lang.Object sequential)
          Initializer for a AlterTableNode for COMPRESS using temporary tables rather than inplace compress
 void init(java.lang.Object objectName, java.lang.Object purge, java.lang.Object defragment, java.lang.Object truncateEndOfTable)
          Initializer for a AlterTableNode for INPLACE COMPRESS
 void init(java.lang.Object objectName, java.lang.Object changeType, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
          Initializer for a AlterTableNode.
 ConstantAction makeConstantAction()
          Create the Constant information that will drive the guts of Execution.
private  void prepConstantAction()
          Generate arguments to constant action.
 void printSubNodes(int depth)
          Prints the sub-nodes of this object.
 boolean referencesSessionSchema()
          Return true if the node references SESSION schema tables (temporary or permanent)
 java.lang.String statementToString()
           
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.DDLStatementNode
activationKind, bindName, generate, getFullName, getObjectName, getRelativeName, getSchemaDescriptor, getSchemaDescriptor, getTableDescriptor, getTableDescriptor, getTableDescriptor, getTableDescriptor, initAndCheck, isAtomic, makeFromList
 
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
executeSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilation, makeResultDescription, needsSavepoint, optimizeStatement, updateIndexStatisticsFor
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tableElementList

public TableElementList tableElementList

lockGranularity

public char lockGranularity

updateStatistics

private boolean updateStatistics
updateStatistics will indicate that we are here for updating the statistics. It could be statistics of just one index or all the indexes on a given table.


updateStatisticsAll

private boolean updateStatisticsAll
The flag updateStatisticsAll will tell if we are going to update the statistics of all indexes or just one index on a table.


dropStatistics

private boolean dropStatistics
dropStatistics will indicate that we are here for dropping the statistics. It could be statistics of just one index or all the indexes on a given table.


dropStatisticsAll

private boolean dropStatisticsAll
The flag dropStatisticsAll will tell if we are going to drop the statistics of all indexes or just one index on a table.


indexNameForStatistics

private java.lang.String indexNameForStatistics
If statistic is getting updated/dropped for just one index, then indexNameForStatistics will tell the name of the specific index whose statistics need to be updated/dropped.


compressTable

public boolean compressTable

sequential

public boolean sequential

purge

public boolean purge

defragment

public boolean defragment

truncateEndOfTable

public boolean truncateEndOfTable

behavior

public int behavior

baseTable

public TableDescriptor baseTable

numConstraints

protected int numConstraints

changeType

private int changeType

truncateTable

private boolean truncateTable

schemaDescriptor

protected SchemaDescriptor schemaDescriptor

colInfos

protected ColumnInfo[] colInfos

conActions

protected ConstraintConstantAction[] conActions
Constructor Detail

AlterTableNode

public AlterTableNode()
Method Detail

init

public void init(java.lang.Object objectName)
          throws StandardException
Initializer for a TRUNCATE TABLE

Specified by:
init in interface Node
Overrides:
init in class DDLStatementNode
Parameters:
objectName - The name of the table being truncated
Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object objectName,
                 java.lang.Object sequential)
          throws StandardException
Initializer for a AlterTableNode for COMPRESS using temporary tables rather than inplace compress

Specified by:
init in interface Node
Overrides:
init in class QueryTreeNode
Parameters:
objectName - The name of the table being altered
sequential - Whether or not the COMPRESS is SEQUENTIAL
Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object objectName,
                 java.lang.Object purge,
                 java.lang.Object defragment,
                 java.lang.Object truncateEndOfTable)
          throws StandardException
Initializer for a AlterTableNode for INPLACE COMPRESS

Specified by:
init in interface Node
Overrides:
init in class QueryTreeNode
Parameters:
objectName - The name of the table being altered
purge - PURGE during INPLACE COMPRESS?
defragment - DEFRAGMENT during INPLACE COMPRESS?
truncateEndOfTable - TRUNCATE END during INPLACE COMPRESS?
Throws:
StandardException - Thrown on error

init

public void init(java.lang.Object objectName,
                 java.lang.Object changeType,
                 java.lang.Object param1,
                 java.lang.Object param2,
                 java.lang.Object param3)
          throws StandardException
Initializer for a AlterTableNode. The parameter values have different meanings based on what kind of ALTER TABLE is taking place.

Specified by:
init in interface Node
Overrides:
init in class QueryTreeNode
Parameters:
objectName - The name of the table being altered
changeType - ADD_TYPE or DROP_TYPE or UPDATE_STATISTICS or or DROP_STATISTICS
param1 - For ADD_TYPE or DROP_TYPE, param1 gives the elements impacted by ALTER TABLE. For UPDATE_STATISTICS or or DROP_STATISTICS, param1 is boolean - true means update or drop the statistics of all the indexes on the table. False means, update or drop the statistics of only the index name provided by next parameter.
param2 - For ADD_TYPE or DROP_TYPE, param2 gives the new lock granularity, if any For UPDATE_STATISTICS or DROP_STATISTICS, param2 can be the name of the specific index whose statistics will be dropped/updated. This param is used only if param1 is set to false
param3 - For DROP_TYPE, param3 can indicate if the drop column is CASCADE or RESTRICTED. This param is ignored for all the other changeType.
Throws:
StandardException - Thrown on error

toString

public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Overrides:
toString in class DDLStatementNode
Returns:
This object as a String

printSubNodes

public void printSubNodes(int depth)
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Overrides:
printSubNodes in class QueryTreeNode
Parameters:
depth - The depth to indent the sub-nodes

statementToString

public java.lang.String statementToString()
Specified by:
statementToString in class StatementNode

getChangeType

public int getChangeType()

bindStatement

public void bindStatement()
                   throws StandardException
Bind this AlterTableNode. This means doing any static error checking that can be done before actually creating the table. For example, verifying that the user is not trying to add a non-nullable column.

Overrides:
bindStatement in class StatementNode
Throws:
StandardException - Thrown on error

referencesSessionSchema

public boolean referencesSessionSchema()
                                throws StandardException
Return true if the node references SESSION schema tables (temporary or permanent)

Overrides:
referencesSessionSchema in class QueryTreeNode
Returns:
true if references SESSION schema tables, else false
Throws:
StandardException - Thrown on error

makeConstantAction

public ConstantAction makeConstantAction()
                                  throws StandardException
Create the Constant information that will drive the guts of Execution.

Overrides:
makeConstantAction in class QueryTreeNode
Throws:
StandardException - Thrown on failure

prepConstantAction

private void prepConstantAction()
                         throws StandardException
Generate arguments to constant action. Called by makeConstantAction() in this class and in our subclass RepAlterTableNode.

Throws:
StandardException - Thrown on failure

genColumnInfo

public void genColumnInfo()
                   throws StandardException
Generate the ColumnInfo argument for the constant action. Return the number of constraints.

Throws:
StandardException

acceptChildren

void acceptChildren(Visitor v)
              throws StandardException
Accept the visitor for all visitable children of this node.

Overrides:
acceptChildren in class QueryTreeNode
Parameters:
v - the visitor
Throws:
StandardException - on error

Built on Wed 2013-06-12 15:21:56+0000, from revision ???

Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.