org.apache.derby.impl.sql.compile
Class ActivationClassBuilder

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.ExpressionClassBuilder
      extended by org.apache.derby.impl.sql.compile.ActivationClassBuilder
All Implemented Interfaces:
ExpressionClassBuilderInterface

 class ActivationClassBuilder
extends ExpressionClassBuilder

ActivationClassBuilder provides an interface to satisfy generation's common tasks in building an activation class, as well as a repository for the JavaFactory used to generate the basic language constructs for the methods in the class. Common tasks include the setting of a static field for each expression function that gets added, the creation of the execute method that gets expanded as the query tree is walked, setting the superclass.

An activation class is defined for each statement. It has the following basic layout: TBD See the document \\Jeeves\Unversioned Repository 1\Internal Technical Documents\Other\GenAndExec.doc for details.

We could also verify methods as they are added, to have 0 parameters, ...


Field Summary
private  MethodBuilder closeActivationMethod
           
private  LocalField cursorResultSetField
           
private  LocalField targetResultSetField
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.ExpressionClassBuilder
cb, cdtField, constructor, currentDatetimeFieldName, executeMethod, gc, myCompCtx, nextExprNum, nextFieldNum, nextNonFastExpr
 
Constructor Summary
ActivationClassBuilder(java.lang.String superClass, CompilerContext cc)
          By the time this is done, it has constructed the following class: public class #className extends #superClass { // public void reset() { return; } public ResultSet execute() throws StandardException { throwIfClosed("execute"); // statements must be added here } public #className() { super(); } }
 
Method Summary
(package private)  void addCursorPositionCode()
          Updatable cursors need to add a getter method for use in BaseActivation to access the result set that identifies target rows for a positioned update or delete.
private  MethodBuilder beginExecuteMethod()
          By the time this is done, it has generated the following code public ResultSet execute() throws StandardException { throwIfClosed("execute"); // statements must be added here } }
(package private)  void finishExecuteMethod(boolean genMarkAsTopNode)
          An execute method always ends in a return statement, returning the result set that has been constructed.
(package private)  java.lang.String getBaseClassName()
          The base class for activations is BaseActivation
(package private)  MethodBuilder getCloseActivationMethod()
           
protected  LocalField getCurrentSetup()
           
 java.lang.String getPackageName()
          Get the package name that this generated class lives in
 int getRowCount()
          Get the number of ExecRows to allocate
(package private)  void rememberCursor(MethodBuilder mb)
          Updatable cursors need to add a field and its initialization for use in BaseActivation to access the result set that identifies cursor result rows for a positioned update or delete.
(package private)  void rememberCursorTarget(MethodBuilder mb)
          Updatable cursors need to add a field and its initialization for use in BaseActivation to access the result set that identifies target rows for a positioned update or delete.
 void setNumSubqueries()
          Generate the assignment for numSubqueries = x
(package private)  MethodBuilder startResetMethod()
           
 
Methods inherited from class org.apache.derby.impl.sql.compile.ExpressionClassBuilder
addColumnToOrdering, addItem, finishConstructor, generateDataValue, generateNull, generateNullWithExpress, getClassBuilder, getColumnOrdering, getColumnOrdering, getConstructor, getCurrentDateExpression, getCurrentTimeExpression, getCurrentTimestampExpression, getExecuteMethod, getGeneratedClass, getRowLocationScanResultSetName, getTypeCompiler, newExprFun, newFieldDeclaration, newFieldDeclaration, newGeneratedFun, newGeneratedFun, newRowLocationScanResultSetName, newUserExprFun, pushColumnReference, pushDataValueFactory, pushGetExecutionFactoryExpression, pushGetResultSetFactoryExpression, pushMethodReference, pushPVSReference, pushThisAsActivation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetResultSetField

private LocalField targetResultSetField

cursorResultSetField

private LocalField cursorResultSetField

closeActivationMethod

private MethodBuilder closeActivationMethod
Constructor Detail

ActivationClassBuilder

ActivationClassBuilder(java.lang.String superClass,
                       CompilerContext cc)
                 throws StandardException
By the time this is done, it has constructed the following class:
    public class #className extends #superClass {
                // public void reset() { return; }
                public ResultSet execute() throws StandardException {
                        throwIfClosed("execute");
                        // statements must be added here
                }
                public #className() { super(); }
    }
 

Throws:
StandardException - thrown on failure
Method Detail

getPackageName

public java.lang.String getPackageName()
Get the package name that this generated class lives in

Specified by:
getPackageName in class ExpressionClassBuilder
Returns:
package name

getBaseClassName

java.lang.String getBaseClassName()
The base class for activations is BaseActivation

Specified by:
getBaseClassName in class ExpressionClassBuilder

getRowCount

public int getRowCount()
                throws StandardException
Get the number of ExecRows to allocate

Specified by:
getRowCount in class ExpressionClassBuilder
Returns:
package name
Throws:
StandardException - thrown on failure

setNumSubqueries

public void setNumSubqueries()
Generate the assignment for numSubqueries = x

Specified by:
setNumSubqueries in class ExpressionClassBuilder
Throws:
StandardException - thrown on failure

beginExecuteMethod

private MethodBuilder beginExecuteMethod()
                                  throws StandardException
By the time this is done, it has generated the following code
                public ResultSet execute() throws StandardException {
                        throwIfClosed("execute");
                        // statements must be added here
                }
    }
 

Throws:
StandardException - thrown on failure

startResetMethod

MethodBuilder startResetMethod()

finishExecuteMethod

void finishExecuteMethod(boolean genMarkAsTopNode)
An execute method always ends in a return statement, returning the result set that has been constructed. We want to do some bookkeeping on that statement, so we generate the return given the result set. Upon entry the only word on the stack is the result set expression


addCursorPositionCode

void addCursorPositionCode()
Updatable cursors need to add a getter method for use in BaseActivation to access the result set that identifies target rows for a positioned update or delete.

The code that is generated is:


  public CursorResultSet getTargetResultSet() {
            return targetResultSet;
  }

  public CursorResultSet getCursorResultSet() {
                return cursorResultSet;
  }
 


rememberCursorTarget

void rememberCursorTarget(MethodBuilder mb)
Updatable cursors need to add a field and its initialization for use in BaseActivation to access the result set that identifies target rows for a positioned update or delete.

The code that is generated is:


  private CursorResultSet targetResultSet;

 
The expression that is generated is:

  (ResultSet) (targetResultSet = (CursorResultSet) #expression#)
 


rememberCursor

void rememberCursor(MethodBuilder mb)
Updatable cursors need to add a field and its initialization for use in BaseActivation to access the result set that identifies cursor result rows for a positioned update or delete.

The code that is generated is:


  private CursorResultSet cursorResultSet;

 
The expression that is generated is:

  (ResultSet) (cursorResultSet = (CursorResultSet) #expression#)
 
The expression must be the top stack word when this method is called.


getCurrentSetup

protected LocalField getCurrentSetup()
Overrides:
getCurrentSetup in class ExpressionClassBuilder

getCloseActivationMethod

MethodBuilder getCloseActivationMethod()

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.