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

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
All Implemented Interfaces:
Visitable
Direct Known Subclasses:
AlterTableNode, CreateSchemaNode, CreateStatementNode, DropStatementNode, RenameNode, SavepointNode

public abstract class DDLStatementNode
extends StatementNode

A DDLStatementNode represents any type of DDL statement: CREATE TABLE, CREATE INDEX, ALTER TABLE, etc.

Author:
Jeff Lichtman

Field Summary
static int ADD_TYPE
           
static int DROP_TYPE
           
(package private)  boolean implicitCreateSchema
          sub-classes can set this to be true to allow implicit creation of the main object's schema at execution time.
private  boolean initOk
           
static int LOCKING_TYPE
           
static int MODIFY_TYPE
           
private  TableName objectName
           
static int 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
DDLStatementNode()
           
 
Method Summary
(package private)  int activationKind()
           
 void bindName(DataDictionary dataDictionary)
          Bind the object Name.
private  TableDescriptor checkTableDescriptor(TableDescriptor td)
           
 void generate(ActivationClassBuilder acb, MethodBuilder mb)
          Generic generate code for all DDL statements.
 java.lang.String getFullName()
          Return the full dot expression name of the object being dropped.
 TableName getObjectName()
           
 java.lang.String getRelativeName()
          Return the name of the table being dropped.
protected  SchemaDescriptor getSchemaDescriptor()
          Get a schema descriptor for this DDL object.
protected  TableDescriptor getTableDescriptor()
           
protected  TableDescriptor getTableDescriptor(TableName tableName)
          Validate that the table is ok for DDL -- e.g.
protected  TableDescriptor getTableDescriptor(UUID tableId)
           
 void init(java.lang.Object objectName)
          Initialize a query tree node.
protected  void initAndCheck(java.lang.Object objectName)
          Initialize the object name we will be performing the DDL on and check that we are not in the system schema and that DDL is allowed.
 boolean isAtomic()
          A DDL statement is always atomic
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
generate, lockTableForCompilation, statementToString
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bind, 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, init, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, printSubNodes, referencesSessionSchema, 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

UNKNOWN_TYPE

public static final int UNKNOWN_TYPE
See Also:
Constant Field Values

ADD_TYPE

public static final int ADD_TYPE
See Also:
Constant Field Values

DROP_TYPE

public static final int DROP_TYPE
See Also:
Constant Field Values

MODIFY_TYPE

public static final int MODIFY_TYPE
See Also:
Constant Field Values

LOCKING_TYPE

public static final int LOCKING_TYPE
See Also:
Constant Field Values

objectName

private TableName objectName

initOk

private boolean initOk

implicitCreateSchema

boolean implicitCreateSchema
sub-classes can set this to be true to allow implicit creation of the main object's schema at execution time.

Constructor Detail

DDLStatementNode

public DDLStatementNode()
Method Detail

init

public void init(java.lang.Object objectName)
          throws StandardException
Description copied from class: QueryTreeNode
Initialize a query tree node.

Overrides:
init in class QueryTreeNode
Throws:
StandardException - Thrown on error

initAndCheck

protected void initAndCheck(java.lang.Object objectName)
                     throws StandardException
Initialize the object name we will be performing the DDL on and check that we are not in the system schema and that DDL is allowed.

Throws:
StandardException

isAtomic

public boolean isAtomic()
A DDL statement is always atomic

Overrides:
isAtomic in class StatementNode
Returns:
true

getRelativeName

public java.lang.String getRelativeName()
Return the name of the table being dropped. This is the unqualified table name.

Returns:
the relative name

getFullName

public java.lang.String getFullName()
Return the full dot expression name of the object being dropped.

Returns:
the full name

getObjectName

public final TableName getObjectName()

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 StatementNode
Returns:
This object as a String

activationKind

int activationKind()
Specified by:
activationKind in class StatementNode

generate

public final void generate(ActivationClassBuilder acb,
                           MethodBuilder mb)
                    throws StandardException
Generic generate code for all DDL statements.

Overrides:
generate in class QueryTreeNode
Parameters:
acb - The ActivationClassBuilder for the class being built
mb - The execute() method to be built
Returns:
A compiled expression returning the RepCreatePublicationResultSet
Throws:
StandardException - Thrown on error

getSchemaDescriptor

protected final SchemaDescriptor getSchemaDescriptor()
                                              throws StandardException
Get a schema descriptor for this DDL object. Uses this.objectName. Always returns a schema, we lock in the schema name prior to execution.

Returns:
Schema Descriptor
Throws:
StandardException - throws on schema name that doesn't exist

getTableDescriptor

protected final TableDescriptor getTableDescriptor()
                                            throws StandardException
Throws:
StandardException

getTableDescriptor

protected final TableDescriptor getTableDescriptor(UUID tableId)
                                            throws StandardException
Throws:
StandardException

getTableDescriptor

protected final TableDescriptor getTableDescriptor(TableName tableName)
                                            throws StandardException
Validate that the table is ok for DDL -- e.g. that it exists, it is not a view, and is not a system table, and that its schema is ok.

Returns:
the validated table descriptor, never null
Throws:
StandardException - on error

checkTableDescriptor

private TableDescriptor checkTableDescriptor(TableDescriptor td)
                                      throws StandardException
Throws:
StandardException

bindName

public void bindName(DataDictionary dataDictionary)
              throws StandardException
Bind the object Name. This means filling in the schema name if it wasn't specified.

Parameters:
dataDictionary - Data dictionary to bind against.
Throws:
StandardException - Thrown on error

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.