Class ExecSPSNode

All Implemented Interfaces:
Visitable

class ExecSPSNode extends StatementNode
A ExecSPSNode is the root of a QueryTree that represents an EXECUTE STATEMENT statement. It is a tad abnormal. During a bind, it locates and retrieves the SPSDescriptor for the particular statement. At generate time, it generates the prepared statement for the stored prepared statement and returns it (i.e. it effectively replaces itself with the appropriate prepared statement).
  • Field Details

  • Constructor Details

    • ExecSPSNode

      ExecSPSNode(TableName newObjectName, ContextManager cm)
      Constructor for a ExecSPSNode
      Parameters:
      newObjectName - The name of the table to be created
      cm - The context manager
      Throws:
      StandardException - Thrown on error
  • Method Details

    • bindStatement

      public void bindStatement() throws StandardException
      Bind this ExecSPSNode. This means doing any static error checking that can be done before actually creating the table. For example, verifying that the ResultColumnList does not contain any duplicate column names.
      Overrides:
      bindStatement in class StatementNode
      Throws:
      StandardException - Thrown on error
    • isAtomic

      public boolean isAtomic()
      SPSes are atomic if its underlying statement is atomic.
      Overrides:
      isAtomic in class StatementNode
      Returns:
      true if the statement is atomic
    • generate

      public GeneratedClass generate(ByteArray ignored) throws StandardException
      Do code generation for this statement. Overrides the normal generation path in StatementNode.
      Overrides:
      generate in class StatementNode
      Parameters:
      ignored - - ignored (he he)
      Returns:
      A GeneratedClass for this statement
      Throws:
      StandardException - Thrown on error
    • makeResultDescription

      public ResultDescription makeResultDescription()
      Make the result description. Really, we are just copying it from the stored prepared statement.
      Overrides:
      makeResultDescription in class StatementNode
      Returns:
      the description
    • getCursorInfo

      public Object getCursorInfo()
      Get information about this cursor. For sps, this is info saved off of the original query tree (the one for the underlying query).
      Overrides:
      getCursorInfo in class StatementNode
      Returns:
      the cursor info
    • getParameterTypes

      public DataTypeDescriptor[] getParameterTypes() throws StandardException
      Return a description of the ? parameters for the statement represented by this query tree. Just return the params stored with the prepared statement.
      Overrides:
      getParameterTypes in class QueryTreeNode
      Returns:
      An array of DataTypeDescriptors describing the ? parameters for this statement. It returns null if there are no parameters.
      Throws:
      StandardException - on error
    • makeConstantAction

      public ConstantAction makeConstantAction()
      Create the Constant information that will drive the guts of Execution. This is assumed to be the first action on this node.
      Overrides:
      makeConstantAction in class QueryTreeNode
    • needsSavepoint

      public boolean needsSavepoint()
      We need a savepoint if we will do transactional work. We'll ask the underlying statement if it needs a savepoint and pass that back. We have to do this after generation because getting the PS now might cause us to basically do DDL (for a stmt recompilation) which is explicitly banned during binding. So the caller can only call this after generate() has retrieved the target PS.
      Overrides:
      needsSavepoint in class StatementNode
      Returns:
      boolean always true.
    • executeStatementName

      public String executeStatementName()
      Description copied from class: StatementNode
      Returns the name of statement in EXECUTE STATEMENT command. Returns null for all other commands.
      Overrides:
      executeStatementName in class StatementNode
      Returns:
      String null unless overridden for Execute Statement command
      See Also:
    • executeSchemaName

      public String executeSchemaName()
      Description copied from class: StatementNode
      Returns name of schema in EXECUTE STATEMENT command. Returns null for all other commands.
      Overrides:
      executeSchemaName in class StatementNode
      Returns:
      String schema for EXECUTE STATEMENT null for all others
      See Also:
    • getSPSName

      public String getSPSName()
      Get the name of the SPS that is used to execute this statement. Only relevant for an ExecSPSNode -- otherwise, returns null.
      Overrides:
      getSPSName in class StatementNode
      Returns:
      the name of the underlying sps
    • activationKind

      int activationKind()
      Specified by:
      activationKind in class StatementNode
    • statementToString

      String statementToString()
      Specified by:
      statementToString in class StatementNode
    • acceptChildren

      void acceptChildren(Visitor v) throws StandardException
      Description copied from class: QueryTreeNode
      Accept a visitor on all child nodes. All sub-classes that add fields that should be visited, should override this method and call accept(v) on all visitable fields, as well as super.acceptChildren(v) to make sure all visitable fields defined by the super-class are accepted too.
      Overrides:
      acceptChildren in class QueryTreeNode
      Parameters:
      v - the visitor
      Throws:
      StandardException - on errors raised by the visitor