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:
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  java.lang.String indexNameForUpdateStatistics
          If statistic is getting updated for just one index, then indexNameForUpdateStatistics will tell the name of the specific index whose statistics need to be updated.
 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_TYPE, implicitCreateSchema, LOCKING_TYPE, MODIFY_TYPE, UNKNOWN_TYPE
 
Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode
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 updateStatisticsAll, java.lang.Object indexName)
          Initializer for a AlterTableNode for updating the statistics.
 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 tableElementList, java.lang.Object lockGranularity, java.lang.Object changeType, java.lang.Object behavior)
          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
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bindOffsetFetch, bindRowMultiSet, 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, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, 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.


indexNameForUpdateStatistics

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


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

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 updateStatisticsAll,
                 java.lang.Object indexName)
          throws StandardException
Initializer for a AlterTableNode for updating the statistics. The user can ask for update statistic of all the indexes or only a specific index

Overrides:
init in class QueryTreeNode
Parameters:
objectName - The name of the table whose index(es) will have their statistics updated.
updateStatisticsAll - If true then update the statistics of all the indexes on the table. If false, then update the statistics of only the index provided as 3rd parameter here
indexName - Only used if updateStatisticsAll is set to false.
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

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

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 tableElementList,
                 java.lang.Object lockGranularity,
                 java.lang.Object changeType,
                 java.lang.Object behavior)
          throws StandardException
Initializer for a AlterTableNode

Overrides:
init in class QueryTreeNode
Parameters:
objectName - The name of the table being altered
tableElementList - The alter table action
lockGranularity - The new lock granularity, if any
changeType - ADD_TYPE or DROP_TYPE
behavior - If drop column is CASCADE or RESTRICTED
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 Thu 2011-03-10 11:54:14+0000, from revision ???

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