|
|||||||||
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 ValueNode |
fetchFirst
|
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 ResultColumnDescriptor[] |
targetColumnDescriptors
|
static int |
UNSPECIFIED
|
private java.util.Vector |
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 |
---|
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 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 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. |
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 java.lang.String statementType
private int updateMode
private boolean needTarget
private java.util.Vector updatableColumns
private FromTable updateTable
private ResultColumnDescriptor[] targetColumnDescriptors
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 updateMode, java.lang.Object updatableColumns)
init
in class QueryTreeNode
statementType
- 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 updateMode
- 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 StatementNode
public java.lang.String statementToString()
statementToString
in class StatementNode
private static java.lang.String updateModeString(int updateMode)
updateMode
- An updateMode identifier
public void printSubNodes(int depth)
printSubNodes
in class DMLStatementNode
depth
- The depth of this node in the treepublic void bindStatement() throws StandardException
bindStatement
in class StatementNode
StandardException
- Thrown on errorpublic boolean referencesSessionSchema() throws StandardException
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorprotected 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 errorpublic void optimizeStatement() throws StandardException
optimizeStatement
in class DMLStatementNode
StandardException
- Thrown on errorint activationKind()
activationKind
in class DMLStatementNode
StandardException
- Thrown on errorpublic void generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- 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
StandardException
public 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 QueryTreeNode
StandardException
- thrown if generation failsprivate void bindUpdateColumns(FromTable targetTable) throws StandardException
targetTable
- The underlying target table
StandardException
- Thrown on errorprivate java.lang.String[] getUpdateColumnNames()
public java.lang.String getXML()
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |