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

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.StatementNode
          extended byorg.apache.derby.impl.sql.compile.DDLStatementNode
              extended byorg.apache.derby.impl.sql.compile.RenameNode
All Implemented Interfaces:
Visitable

public class RenameNode
extends DDLStatementNode

A RenameNode is the root of a QueryTree that represents a RENAME TABLE/COLUMN/INDEX statement.

Author:
Mamta Satoor

Field Summary
private  long conglomerateNumber
           
protected  java.lang.String newObjectName
           
protected  TableName newTableName
           
protected  java.lang.String oldObjectName
           
protected  int renamingWhat
           
protected  TableDescriptor td
           
protected  boolean usedAlterTable
           
 
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_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
RenameNode()
           
 
Method Summary
 QueryTreeNode bind()
          Bind this node.
private  StandardException descriptorExistsException(TupleDescriptor tuple, TupleDescriptor parent)
           
 void init(java.lang.Object tableName, java.lang.Object oldObjectName, java.lang.Object newObjectName, java.lang.Object usedAlterTable, java.lang.Object renamingWhat)
          Initializer for a RenameNode
 ConstantAction makeConstantAction()
          Create the Constant information that will drive the guts of Execution
 boolean referencesSessionSchema()
          Return true if the node references SESSION schema tables (temporary or permanent)
private  void renameColumnBind(DataDictionary dd)
           
private  void renameTableBind(DataDictionary dd)
           
 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, getTableDescriptor, getTableDescriptor, getTableDescriptor, init, initAndCheck, isAtomic
 
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
generate, lockTableForCompilation
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, 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, init, isInstanceOf, isSessionSchema, isSessionSchema, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, printSubNodes, 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

newTableName

protected TableName newTableName

oldObjectName

protected java.lang.String oldObjectName

newObjectName

protected java.lang.String newObjectName

td

protected TableDescriptor td

conglomerateNumber

private long conglomerateNumber

usedAlterTable

protected boolean usedAlterTable

renamingWhat

protected int renamingWhat
Constructor Detail

RenameNode

public RenameNode()
Method Detail

init

public void init(java.lang.Object tableName,
                 java.lang.Object oldObjectName,
                 java.lang.Object newObjectName,
                 java.lang.Object usedAlterTable,
                 java.lang.Object renamingWhat)
          throws StandardException
Initializer for a RenameNode

Overrides:
init in class QueryTreeNode
Parameters:
tableName - The name of the table. This is the table which is being renamed in case of rename table. In case of rename column, the column being renamed belongs to this table. In case of rename index, this is null because index name is unique within a schema and doesn't have to be associated with a table name
oldObjectName - This is either the name of column/index in case of rename column/index. For rename table, this is null.
newObjectName - This is new name for table/column/index
usedAlterTable - True-Used Alter Table, False-Used Rename. For rename index, this will always be false because there is no alter table command to rename index
renamingWhat - Rename a 1 - table, 2 - column, 3 - index
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

statementToString

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

bind

public QueryTreeNode bind()
                   throws StandardException
Bind this node. This means doing any static error checking that can be done before actually renaming the table/column/index. For a table rename: looking up the from table, verifying it exists verifying it's not a system table, verifying it's not view and looking up to table, verifying it doesn't exist. For a column rename: looking up the table, verifying it exists, verifying it's not a system table, verifying it's not view, verifying the from column exists, verifying the to column doesn't exist. For a index rename: looking up the table, verifying it exists, verifying it's not a system table, verifying it's not view, verifying the from index exists, verifying the to index doesn't exist.

Overrides:
bind in class QueryTreeNode
Returns:
The bound query tree
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

renameTableBind

private void renameTableBind(DataDictionary dd)
                      throws StandardException
Throws:
StandardException

renameColumnBind

private void renameColumnBind(DataDictionary dd)
                       throws StandardException
Throws:
StandardException

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

descriptorExistsException

private StandardException descriptorExistsException(TupleDescriptor tuple,
                                                    TupleDescriptor parent)

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.