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

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.CreateTriggerNode
All Implemented Interfaces:
Visitable

public class CreateTriggerNode
extends DDLStatementNode

A CreateTriggerNode is the root of a QueryTree that represents a CREATE TRIGGER statement.


Field Summary
private  UUID actionCompSchemaId
           
private  StatementNode actionNode
           
private  int actionOffset
           
private  java.lang.String actionText
           
private  SchemaDescriptor compSchemaDescriptor
           
private  boolean isBefore
           
private  boolean isEnabled
           
private  boolean isRow
           
private  boolean newTableInReferencingClause
           
private  java.lang.String newTableName
           
private  boolean oldTableInReferencingClause
           
private  java.lang.String oldTableName
           
private  java.lang.String originalActionText
           
private  java.util.Vector refClause
           
private  int[] referencedColInts
           
private  TableName tableName
           
private  ResultColumnList triggerCols
           
private  int triggerEventMask
           
private  TableName triggerName
           
private  SchemaDescriptor triggerSchemaDescriptor
           
private  TableDescriptor triggerTableDescriptor
           
private  ValueNode whenClause
           
private  int whenOffset
           
private  java.lang.String whenText
           
 
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
CreateTriggerNode()
           
 
Method Summary
private  boolean bindReferencesClause(DataDictionary dd)
           
 void bindStatement()
          Bind this CreateTriggerNode.
private  void checkInvalidTriggerReference(java.lang.String tableName)
           
private  boolean equals(java.lang.String left, java.lang.String right)
           
private  void forbidActionsOnGenCols()
           
private  java.lang.String genColumnReferenceSQL(DataDictionary dd, java.lang.String colName, java.lang.String tabName, boolean isOldTable)
           
 void init(java.lang.Object triggerName, java.lang.Object tableName, java.lang.Object triggerEventMask, java.lang.Object triggerCols, java.lang.Object isBefore, java.lang.Object isRow, java.lang.Object isEnabled, java.lang.Object refClause, java.lang.Object whenClause, java.lang.Object whenText, java.lang.Object whenOffset, java.lang.Object actionNode, java.lang.Object actionText, java.lang.Object actionOffset)
          Initializer for a CreateTriggerNode
 ConstantAction makeConstantAction()
          Create the Constant information that will drive the guts of Execution.
 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)
private  QueryTreeNode[] sortRefs(java.util.Vector refs, boolean isRow)
           
 java.lang.String statementToString()
           
 java.lang.String toString()
          Convert this object to a String.
private  void validateReferencesClause(DataDictionary dd)
           
 
Methods inherited from class org.apache.derby.impl.sql.compile.DDLStatementNode
activationKind, bindName, generate, getFullName, getObjectName, getRelativeName, getSchemaDescriptor, getSchemaDescriptor, getTableDescriptor, getTableDescriptor, getTableDescriptor, getTableDescriptor, init, 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, acceptChildren, 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, 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

triggerName

private TableName triggerName

tableName

private TableName tableName

triggerEventMask

private int triggerEventMask

triggerCols

private ResultColumnList triggerCols

isBefore

private boolean isBefore

isRow

private boolean isRow

isEnabled

private boolean isEnabled

refClause

private java.util.Vector refClause

whenClause

private ValueNode whenClause

whenText

private java.lang.String whenText

whenOffset

private int whenOffset

actionNode

private StatementNode actionNode

actionText

private java.lang.String actionText

originalActionText

private java.lang.String originalActionText

actionOffset

private int actionOffset

triggerSchemaDescriptor

private SchemaDescriptor triggerSchemaDescriptor

compSchemaDescriptor

private SchemaDescriptor compSchemaDescriptor

referencedColInts

private int[] referencedColInts

triggerTableDescriptor

private TableDescriptor triggerTableDescriptor

actionCompSchemaId

private UUID actionCompSchemaId

oldTableName

private java.lang.String oldTableName

newTableName

private java.lang.String newTableName

oldTableInReferencingClause

private boolean oldTableInReferencingClause

newTableInReferencingClause

private boolean newTableInReferencingClause
Constructor Detail

CreateTriggerNode

public CreateTriggerNode()
Method Detail

init

public void init(java.lang.Object triggerName,
                 java.lang.Object tableName,
                 java.lang.Object triggerEventMask,
                 java.lang.Object triggerCols,
                 java.lang.Object isBefore,
                 java.lang.Object isRow,
                 java.lang.Object isEnabled,
                 java.lang.Object refClause,
                 java.lang.Object whenClause,
                 java.lang.Object whenText,
                 java.lang.Object whenOffset,
                 java.lang.Object actionNode,
                 java.lang.Object actionText,
                 java.lang.Object actionOffset)
          throws StandardException
Initializer for a CreateTriggerNode

Overrides:
init in class QueryTreeNode
Parameters:
triggerName - name of the trigger
tableName - name of the table which the trigger is declared upon
triggerEventMask - TriggerDescriptor.TRIGGER_EVENT_XXX
triggerCols - columns trigger is to fire upon. Valid for UPDATE case only.
isBefore - is before trigger (false for after)
isRow - true for row trigger, false for statement
isEnabled - true if enabled
refClause - the referencing clause
whenClause - the WHEN clause tree
whenText - the text of the WHEN clause
whenOffset - offset of start of WHEN clause
actionNode - the trigger action tree
actionText - the text of the trigger action
actionOffset - offset of start of action clause
Throws:
StandardException - Thrown on error

statementToString

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

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 of this node in the tree

bindStatement

public void bindStatement()
                   throws StandardException
Bind this CreateTriggerNode. This means doing any static error checking that can be done before actually creating the table.

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

bindReferencesClause

private boolean bindReferencesClause(DataDictionary dd)
                              throws StandardException
Throws:
StandardException

sortRefs

private QueryTreeNode[] sortRefs(java.util.Vector refs,
                                 boolean isRow)

forbidActionsOnGenCols

private void forbidActionsOnGenCols()
                             throws StandardException
Throws:
StandardException

equals

private boolean equals(java.lang.String left,
                       java.lang.String right)

genColumnReferenceSQL

private java.lang.String genColumnReferenceSQL(DataDictionary dd,
                                               java.lang.String colName,
                                               java.lang.String tabName,
                                               boolean isOldTable)
                                        throws StandardException
Throws:
StandardException

checkInvalidTriggerReference

private void checkInvalidTriggerReference(java.lang.String tableName)
                                   throws StandardException
Throws:
StandardException

validateReferencesClause

private void validateReferencesClause(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

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

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

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