Class AlterTableNode
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.StatementNode
-
- org.apache.derby.impl.sql.compile.DDLStatementNode
-
- org.apache.derby.impl.sql.compile.AlterTableNode
-
- All Implemented Interfaces:
Visitable
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
Fields Modifier and Type Field Description 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.(package private) 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_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description AlterTableNode(TableName tableName, boolean purge, boolean defragment, boolean truncateEndOfTable, ContextManager cm)
Constructor for INPLACE COMPRESSAlterTableNode(TableName tableName, boolean sequential, ContextManager cm)
Constructor for COMPRESS using temporary tables rather than in place compressAlterTableNode(TableName tableName, int changeType, boolean statsAll, java.lang.String indexName, ContextManager cm)
Constructor for UPDATE_STATISTICS or DROP_STATISTICSAlterTableNode(TableName tableName, int changeType, TableElementList impactedElements, char lockGranularity, int behavior, ContextManager cm)
Constructor for ADD_TYPE, DROP_TYPE, MODIFY_TYPE and LOCK_TYPEAlterTableNode(TableName tableName, ContextManager cm)
Constructor for TRUNCATE TABLE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (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()
ConstantAction
makeConstantAction()
Create the Constant information that will drive the guts of Execution.private void
prepConstantAction()
Generate arguments to constant action.(package private) 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, 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, getCursorInfo, getSPSName, lockTableForCompilation, makeResultDescription, needsSavepoint, optimizeStatement, updateIndexStatisticsFor
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Field Detail
-
tableElementList
public TableElementList tableElementList
-
lockGranularity
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
AlterTableNode(TableName tableName, ContextManager cm) throws StandardException
Constructor for TRUNCATE TABLE- Parameters:
tableName
- The name of the table being truncatedcm
- Context manager- Throws:
StandardException
-
AlterTableNode
AlterTableNode(TableName tableName, boolean sequential, ContextManager cm) throws StandardException
Constructor for COMPRESS using temporary tables rather than in place compress- Parameters:
tableName
- The name of the table being alteredsequential
- Whether or not the COMPRESS is SEQUENTIALcm
- Context manager- Throws:
StandardException
- Thrown on error
-
AlterTableNode
AlterTableNode(TableName tableName, boolean purge, boolean defragment, boolean truncateEndOfTable, ContextManager cm) throws StandardException
Constructor for INPLACE COMPRESS- Parameters:
tableName
- The name of the table being alteredpurge
- PURGE during INPLACE COMPRESS?defragment
- DEFRAGMENT during INPLACE COMPRESS?truncateEndOfTable
- TRUNCATE END during INPLACE COMPRESS?cm
- Context manager- Throws:
StandardException
- Thrown on error
-
AlterTableNode
AlterTableNode(TableName tableName, int changeType, boolean statsAll, java.lang.String indexName, ContextManager cm) throws StandardException
Constructor for UPDATE_STATISTICS or DROP_STATISTICS- Parameters:
tableName
- The name of the table being alteredchangeType
- update or drop statisticsstatsAll
-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.indexName
- Name of the index for which statistics is to be updated or droppedcm
- Context manager- Throws:
StandardException
-
AlterTableNode
AlterTableNode(TableName tableName, int changeType, TableElementList impactedElements, char lockGranularity, int behavior, ContextManager cm) throws StandardException
Constructor for ADD_TYPE, DROP_TYPE, MODIFY_TYPE and LOCK_TYPE- Parameters:
tableName
- The name of the table being alteredchangeType
- add, drop, modify or lockimpactedElements
- list of table elements impactedlockGranularity
- lock granularity encoded in a single characterbehavior
- cascade or restrict (for DROP_TYPE)cm
- Context Manager- Throws:
StandardException
-
-
Method Detail
-
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 classDDLStatementNode
- Returns:
- This object as a String
-
printSubNodes
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 classQueryTreeNode
- Parameters:
depth
- The depth to indent the sub-nodes
-
statementToString
public java.lang.String statementToString()
- Specified by:
statementToString
in classStatementNode
-
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 classStatementNode
- 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 classQueryTreeNode
- 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 classQueryTreeNode
- 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 classDDLStatementNode
- Parameters:
v
- the visitor- Throws:
StandardException
- on error
-
-