org.apache.derby.impl.sql.compile
Class CursorNode
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.StatementNode
-
- org.apache.derby.impl.sql.compile.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.
-
-
Field Summary
Fields Modifier and Type Field and Description static intREAD_ONLY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidbindStatement()Bind this CursorNode.java.lang.ObjectgetCursorInfo()Get information about this cursor.booleanisAtomic()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.ResultDescriptionmakeResultDescription()Make a ResultDescription for use in a PreparedStatement.booleanneedsSavepoint()Returns whether or not this Statement requires a set/clear savepoint around its execution.voidoptimizeStatement()Optimize a DML statement (which is the only type of statement that should need optimizing, I think).booleanreferencesSessionSchema()Return true if the node references SESSION schema tables (temporary or permanent)java.lang.StringtoString()Convert this object to a String.TableDescriptor[]updateIndexStatisticsFor()Returns a list of base tables for which the index statistics of the associated indexes should be updated.-
Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode
executeSchemaName, executeStatementName, generate, getSPSName
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, createTypeDependency, getBeginOffset, getDataDictionary, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getUDTDesc, makeConstantAction, makeTableName, makeTableName, optimizerTracingIsOn, orReliability, setBeginOffset, setEndOffset, taggedWith, treePrint
-
-
-
-
Field Detail
-
READ_ONLY
public static final int READ_ONLY
- See Also:
- Constant Field Values
-
-
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:
toStringin classStatementNode- Returns:
- This object as a String
-
bindStatement
public void bindStatement() throws StandardExceptionBind 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:
bindStatementin classStatementNode- Throws:
StandardException- Thrown on error
-
referencesSessionSchema
public boolean referencesSessionSchema() throws StandardExceptionReturn true if the node references SESSION schema tables (temporary or permanent)- Overrides:
referencesSessionSchemain classQueryTreeNode- Returns:
- true if references SESSION schema tables, else false
- Throws:
StandardException- Thrown on error
-
optimizeStatement
public void optimizeStatement() throws StandardExceptionOptimize 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:
needsSavepointin classStatementNode- Returns:
- boolean Whether or not this Statement requires a set/clear savepoint
-
getCursorInfo
public java.lang.Object getCursorInfo() throws StandardExceptionGet information about this cursor. For sps, this is info saved off of the original query tree (the one for the underlying query).- Overrides:
getCursorInfoin classStatementNode- Returns:
- the cursor info
- Throws:
StandardException- thrown if generation fails
-
updateIndexStatisticsFor
public TableDescriptor[] updateIndexStatisticsFor() throws StandardException
Returns a list of base tables for which the index statistics of the associated indexes should be updated.- Overrides:
updateIndexStatisticsForin classStatementNode- Returns:
- A list of table descriptors (potentially empty).
- Throws:
StandardException- if accessing the index descriptors of a base table 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:
makeResultDescriptionin classStatementNode- Returns:
- A ResultDescription for this DML statement
-
isAtomic
public boolean isAtomic() throws StandardExceptionA 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:
isAtomicin classStatementNode- Returns:
- true if the statement is atomic
- Throws:
StandardException- on error
-
-
DataMelt 3.0 © DataMelt by jWork.ORG