Class CallStatementNode

  • All Implemented Interfaces:
    Visitable

    class CallStatementNode
    extends DMLStatementNode
    An CallStatementNode represents a CALL statement. It is the top node of the query tree for that statement. A procedure call is very simple. CALL [.]() are either constants or parameter markers. This implementation assumes that no subqueries or aggregates can be in the argument list. A procedure is always represented by a MethodCallNode.
    • Field Detail

      • methodCall

        private JavaToSQLValueNode methodCall
        The method call for the Java procedure. Guaranteed to be a JavaToSQLValueNode wrapping a MethodCallNode by checks in the parser.
    • Constructor Detail

      • CallStatementNode

        CallStatementNode​(JavaToSQLValueNode methodCall,
                          ContextManager cm)
        Constructor for a CallStatementNode.
        Parameters:
        methodCall - The expression to "call"
        cm - The context manager
    • Method Detail

      • 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 class DMLStatementNode
        Parameters:
        depth - The depth of this node in the tree
      • bindStatement

        public void bindStatement()
                           throws StandardException
        Bind this UpdateNode. This means looking up tables and columns and getting their types, and figuring out the result types of all expressions, as well as doing view resolution, permissions checking, etc.

        Binding an update will also massage the tree so that the ResultSetNode has a single column, the RID.

        Overrides:
        bindStatement in class StatementNode
        Throws:
        StandardException - Thrown on error
      • optimizeStatement

        public void optimizeStatement()
                               throws StandardException
        Optimize a DML statement (which is the only type of statement that should need optimizing, I think). This method over-rides the one in QueryTreeNode. This method takes a bound tree, and returns an optimized tree. It annotates the bound tree rather than creating an entirely new tree. Throws an exception if the tree is not bound, or if the binding is out of date.
        Overrides:
        optimizeStatement in class DMLStatementNode
        Throws:
        StandardException - Thrown on error
      • makeResultDescription

        public ResultDescription makeResultDescription()
        Description copied from class: DMLStatementNode
        Make a ResultDescription for use in a PreparedStatement. ResultDescriptions are visible to JDBC only for cursor statements. For other types of statements, they are only used internally to get descriptions of the base tables being affected. For example, for an INSERT statement, the ResultDescription describes the rows in the table being inserted into, which is useful when the values being inserted are of a different type or length than the columns in the base table.
        Overrides:
        makeResultDescription in class DMLStatementNode
        Returns:
        A ResultDescription for this DML statement
      • getPrivType

        int getPrivType()
        Set default privilege of EXECUTE for this node.
        Overrides:
        getPrivType in class DMLStatementNode
        Returns:
        true if the statement is atomic
      • checkReliability

        private void checkReliability()
                               throws StandardException
        This method checks if the called procedure allows modification of SQL data. If yes, it cannot be compiled if the reliability is CompilerContext.MODIFIES_SQL_DATA_PROCEDURE_ILLEGAL. This reliability is set for BEFORE triggers in the create trigger node. This check thus disallows creation of BEFORE triggers which contain calls to procedures that modify SQL data in the trigger action statement.
        Throws:
        StandardException
      • getSQLAllowedInProcedure

        private short getSQLAllowedInProcedure()
        This method checks the SQL allowed by the called procedure. This method should be called only after the procedure has been resolved.
        Returns:
        SQL allowed by the procedure