Documentation of 'org.apache.derby.impl.sql.compile.CursorNode' Java class
CursorNode
org.apache.derby.impl.sql.compile

Class CursorNode

  • All Implemented Interfaces:
    Visitable


    public class CursorNode
    extends StatementNode
    A CursorNode represents a result set that can be returned to a client. A cursor can be a named cursor created by the DECLARE CURSOR statement, or it can be an unnamed cursor associated with a SELECT statement (more precisely, a table expression that returns rows to the client). In the latter case, the cursor does not have a name.
    • Method Detail

      • 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
      • bindStatement

        public void bindStatement()
                           throws StandardException
        Bind this CursorNode. 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. It also includes determining whether an UNSPECIFIED cursor is updatable or not, and verifying that an UPDATE cursor actually is.
        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.
        Throws:
        StandardException - Thrown on error
      • needsSavepoint

        public boolean needsSavepoint()
        Returns whether or not this Statement requires a set/clear savepoint around its execution. The following statement "types" do not require them: Cursor - unnecessary and won't work in a read only environment Xact - savepoint will get blown away underneath us during commit/rollback
        Overrides:
        needsSavepoint in class StatementNode
        Returns:
        boolean Whether or not this Statement requires a set/clear savepoint
      • getCursorInfo

        public java.lang.Object getCursorInfo()
                                       throws StandardException
        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
        Throws:
        StandardException - thrown if generation fails
      • makeResultDescription

        public ResultDescription makeResultDescription()
        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 StatementNode
        Returns:
        A ResultDescription for this DML statement
      • isAtomic

        public boolean isAtomic()
                         throws StandardException
        A read statement is atomic (DMLMod overrides us) if there are no work units, and no SELECT nodes, or if its SELECT nodes are all arguments to a function. This is admittedly a bit simplistic, what if someone has:
                VALUES myfunc(SELECT max(c.commitFunc()) FROM T) 
         
        but we aren't going too far out of our way to catch every possible wierd case. We basically want to be permissive w/o allowing someone to partially commit a write.
        Overrides:
        isAtomic in class StatementNode
        Returns:
        true if the statement is atomic
        Throws:
        StandardException - on error

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.