|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.StatementNode
org.apache.derby.impl.sql.compile.DMLStatementNode
org.apache.derby.impl.sql.compile.CursorNode
public class CursorNode
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 | |
|---|---|
private boolean |
checkIndexStats
|
private ValueNode |
fetchFirst
|
private boolean |
hasJDBClimitClause
|
private int |
indexOfSessionTableNamesInSavedObjects
|
private java.lang.String |
name
|
private boolean |
needTarget
|
private ValueNode |
offset
|
private OrderByList |
orderByList
|
static int |
READ_ONLY
|
private java.lang.String |
statementType
|
private java.util.ArrayList |
statsToUpdate
List of TableDescriptors for base tables whose associated
indexes should be checked for stale statistics. |
private ResultColumnDescriptor[] |
targetColumnDescriptors
|
static int |
UNSPECIFIED
|
private java.util.List |
updatableColumns
There can only be a list of updatable columns when FOR UPDATE is specified as part of the cursor specification. |
static int |
UPDATE
|
private int |
updateMode
|
private FromTable |
updateTable
|
| Fields inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode |
|---|
resultSet |
| Fields inherited from class org.apache.derby.impl.sql.compile.StatementNode |
|---|
EMPTY_TD_LIST, 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 | |
|---|---|
CursorNode()
|
|
| Method Summary | |
|---|---|
(package private) int |
activationKind()
Returns the type of activation this class generates. |
void |
bindStatement()
Bind this CursorNode. |
private void |
bindUpdateColumns(FromTable targetTable)
Bind the update columns by their names to the target table of the cursor specification. |
private void |
collectTablePrivsAndStats(FromBaseTable fromTable)
Collects required privileges for all types of tables, and table descriptors for base tables whose index statistics we want to check for staleness (or to create). |
private int |
determineUpdateMode(DataDictionary dataDictionary)
Take a cursor and determine if it is UPDATE or READ_ONLY based on the shape of the cursor specification. |
void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Do code generation for this CursorNode |
private ResultColumnDescriptor[] |
genTargetResultColList()
Positioned update needs to know what the target result set looks like. |
java.lang.Object |
getCursorInfo()
Get information about this cursor. |
protected java.util.ArrayList |
getSessionSchemaTableNamesForCursor()
|
private java.lang.String[] |
getUpdatableColumns()
Return String[] of names from the FOR UPDATE OF List |
java.lang.String |
getUpdateBaseTableName()
|
private java.lang.String[] |
getUpdateColumnNames()
Get an array of strings for each updatable column in this list. |
java.lang.String |
getUpdateExposedTableName()
|
int |
getUpdateMode()
|
java.lang.String |
getUpdateSchemaName()
|
java.lang.String |
getXML()
|
void |
init(java.lang.Object statementType,
java.lang.Object resultSet,
java.lang.Object name,
java.lang.Object orderByList,
java.lang.Object offset,
java.lang.Object fetchFirst,
java.lang.Object hasJDBClimitClause,
java.lang.Object updateMode,
java.lang.Object updatableColumns)
Initializer for a CursorNode |
boolean |
needsSavepoint()
Returns whether or not this Statement requires a set/clear savepoint around its execution. |
void |
optimizeStatement()
Optimize a DML statement (which is the only type of statement that should need optimizing, I think). |
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) |
java.lang.String |
statementToString()
|
java.lang.String |
toString()
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. |
private static java.lang.String |
updateModeString(int updateMode)
Support routine for translating an updateMode identifier to a String |
| Methods inherited from class org.apache.derby.impl.sql.compile.DMLStatementNode |
|---|
acceptChildren, bind, bindExpressions, bindExpressionsWithTables, bindResultSetsWithTables, bindTables, generateParameterValueSet, getPrivType, getResultSetNode, init, isAtomic, makeResultDescription |
| Methods inherited from class org.apache.derby.impl.sql.compile.StatementNode |
|---|
executeSchemaName, executeStatementName, generate, getSPSName, lockTableForCompilation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int UNSPECIFIED
public static final int READ_ONLY
public static final int UPDATE
private java.lang.String name
private OrderByList orderByList
private ValueNode offset
private ValueNode fetchFirst
private boolean hasJDBClimitClause
private java.lang.String statementType
private int updateMode
private boolean needTarget
private java.util.List updatableColumns
private FromTable updateTable
private ResultColumnDescriptor[] targetColumnDescriptors
private java.util.ArrayList statsToUpdate
TableDescriptors for base tables whose associated
indexes should be checked for stale statistics.
private boolean checkIndexStats
private int indexOfSessionTableNamesInSavedObjects
| Constructor Detail |
|---|
public CursorNode()
| Method Detail |
|---|
public void init(java.lang.Object statementType,
java.lang.Object resultSet,
java.lang.Object name,
java.lang.Object orderByList,
java.lang.Object offset,
java.lang.Object fetchFirst,
java.lang.Object hasJDBClimitClause,
java.lang.Object updateMode,
java.lang.Object updatableColumns)
init in interface Nodeinit in class QueryTreeNodestatementType - Type of statement (SELECT, UPDATE, INSERT)resultSet - A ResultSetNode specifying the result set for
the cursorname - The name of the cursor, null if no nameorderByList - The order by list for the cursor, null if no
order by listoffset - The value of a fetchFirst - The value of a hasJDBClimitClause - True if the offset/fetchFirst clauses come from JDBC limit/offset escape syntaxupdateMode - The user-specified update mode for the cursor,
for example, CursorNode.READ_ONLYupdatableColumns - The list of updatable columns specified by
the user in the FOR UPDATE clause, null if no
updatable columns specified. May only be
provided if the updateMode parameter is
CursorNode.UPDATE.public java.lang.String toString()
toString in class StatementNodepublic java.lang.String statementToString()
statementToString in class StatementNodeprivate static java.lang.String updateModeString(int updateMode)
updateMode - An updateMode identifier
public void printSubNodes(int depth)
printSubNodes in class DMLStatementNodedepth - The depth of this node in the tree
public void bindStatement()
throws StandardException
bindStatement in class StatementNodeStandardException - Thrown on errorprivate void collectTablePrivsAndStats(FromBaseTable fromTable)
fromTable - the table
public boolean referencesSessionSchema()
throws StandardException
referencesSessionSchema in class QueryTreeNodeStandardException - Thrown on error
protected java.util.ArrayList getSessionSchemaTableNamesForCursor()
throws StandardException
StandardException
private int determineUpdateMode(DataDictionary dataDictionary)
throws StandardException
The following conditions make a cursor read only:
StandardException - Thrown on error
public void optimizeStatement()
throws StandardException
optimizeStatement in class DMLStatementNodeStandardException - Thrown on errorint activationKind()
activationKind in class DMLStatementNodeStandardException - Thrown on error
public void generate(ActivationClassBuilder acb,
MethodBuilder mb)
throws StandardException
generate in class QueryTreeNodeacb - The ActivationClassBuilder for the class being builtmb - The method the generated code is to go into
StandardException - Thrown on errorpublic java.lang.String getUpdateBaseTableName()
public java.lang.String getUpdateExposedTableName()
throws StandardException
StandardException
public java.lang.String getUpdateSchemaName()
throws StandardException
StandardExceptionpublic int getUpdateMode()
private java.lang.String[] getUpdatableColumns()
private ResultColumnDescriptor[] genTargetResultColList()
throws StandardException
StandardException - Thrown on errorpublic boolean needsSavepoint()
needsSavepoint in class StatementNode
public java.lang.Object getCursorInfo()
throws StandardException
getCursorInfo in class QueryTreeNodeStandardException - thrown if generation fails
private void bindUpdateColumns(FromTable targetTable)
throws StandardException
targetTable - The underlying target table
StandardException - Thrown on errorprivate java.lang.String[] getUpdateColumnNames()
public java.lang.String getXML()
public TableDescriptor[] updateIndexStatisticsFor()
throws StandardException
updateIndexStatisticsFor in class StatementNodeStandardException - if accessing the index descriptors of a base
table fails
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||