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
A AlterTableNode represents a DDL statement that alters a table.
It contains the name of the object to be created.
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
private int
protected ColumnInfo[]
boolean
protected ConstraintConstantAction[]
boolean
private boolean
dropStatistics will indicate that we are here for dropping the statistics.private boolean
The flag dropStatisticsAll will tell if we are going to drop the statistics of all indexes or just one index on a table.private String
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
protected int
boolean
protected SchemaDescriptor
boolean
boolean
private boolean
private boolean
updateStatistics will indicate that we are here for updating the statistics.private boolean
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
ConstructorsConstructorDescriptionAlterTableNode
(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, 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
Modifier and TypeMethodDescription(package private) void
Accept the visitor for all visitable children of this node.void
Bind this AlterTableNode.void
Generate the ColumnInfo argument for the constant action.int
Create the Constant information that will drive the guts of Execution.private void
Generate arguments to constant action.(package private) void
printSubNodes
(int depth) Prints the sub-nodes of this object.boolean
Return true if the node references SESSION schema tables (temporary or permanent)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 Details
-
tableElementList
-
lockGranularity
char lockGranularity -
updateStatistics
private boolean updateStatisticsupdateStatistics 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 updateStatisticsAllThe 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 dropStatisticsdropStatistics 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 dropStatisticsAllThe flag dropStatisticsAll will tell if we are going to drop the statistics of all indexes or just one index on a table. -
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
-
numConstraints
protected int numConstraints -
changeType
private int changeType -
truncateTable
private boolean truncateTable -
schemaDescriptor
-
colInfos
-
conActions
-
-
Constructor Details
-
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, 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 Details
-
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
- Specified by:
statementToString
in classStatementNode
-
getChangeType
public int getChangeType() -
bindStatement
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
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
Create the Constant information that will drive the guts of Execution.- Overrides:
makeConstantAction
in classQueryTreeNode
- Throws:
StandardException
- Thrown on failure
-
prepConstantAction
Generate arguments to constant action. Called by makeConstantAction() in this class and in our subclass RepAlterTableNode.- Throws:
StandardException
- Thrown on failure
-
genColumnInfo
Generate the ColumnInfo argument for the constant action. Return the number of constraints.- Throws:
StandardException
-
acceptChildren
Accept the visitor for all visitable children of this node.- Overrides:
acceptChildren
in classDDLStatementNode
- Parameters:
v
- the visitor- Throws:
StandardException
- on error
-