Top Description Fields Constructors Methods
org.apache.derby.impl.sql.compile

pack-priv Class ActivationClassBuilder

extends ExpressionClassBuilder
Class Inheritance
Imports
java.lang.reflect.Modifier, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.ClassName, org.apache.derby.iapi.services.classfile.VMOpcode, org.apache.derby.iapi.services.compiler.LocalField, .MethodBuilder, org.apache.derby.iapi.sql.compile.CodeGeneration, .CompilerContext

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

Modifier and TypeField and Description
private MethodBuilder
private LocalField
private LocalField
Inherited from org.apache.derby.impl.sql.compile.ExpressionClassBuilder:
cbcdtFieldconstructorcurrentDatetimeFieldNameexecuteMethodgcmyCompCtxnextExprNumnextFieldNumnextNonFastExpr

Constructor Summary

AccessConstructor and Description
pack-priv
ActivationClassBuilder(String superClass, CompilerContext cc)

By the time this is done, it has constructed the following class:

    final public class #className extends #superClass {
		// public void reset() { return; }
		protected ResultSet doExecute() throws StandardException {
			// statements must be added here
		}
      public #className() { super(); }
    }
 

Method Summary

Modifier and TypeMethod and Description
pack-priv 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.</verbatim>

pack-priv void
finishExecuteMethod()

An execute method always ends in a return statement, returning the result set that has been constructed.

pack-priv String
getBaseClassName()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getBaseClassName.

The base class for activations is BaseActivation

pack-priv MethodBuilder
protected LocalField
public String

Returns:

package name
getPackageName
()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getPackageName.

Get the package name that this generated class lives in

public int

Returns:

package name
getRowCount
()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getRowCount.

Get the number of ExecRows to allocate

pack-priv 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.</verbatim></verbatim>

pack-priv 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.</verbatim></verbatim>

public void
setNumSubqueries()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.setNumSubqueries.

Generate the assignment for numSubqueries = x

pack-priv MethodBuilder
Inherited from org.apache.derby.impl.sql.compile.ExpressionClassBuilder:
addColumnToOrderingaddItemfinishConstructorgenerateDataValuegenerateNullgenerateNullWithExpressgetClassBuildergetColumnOrderinggetColumnOrderinggetConstructorgetCurrentDateExpressiongetCurrentTimeExpressiongetCurrentTimestampExpressiongetExecuteMethodgetGeneratedClassgetRowLocationScanResultSetNamegetTypeCompilernewExprFunnewFieldDeclarationnewFieldDeclarationnewGeneratedFunnewGeneratedFunnewRowLocationScanResultSetNamenewUserExprFunpushColumnReferencepushDataValueFactorypushGetExecutionFactoryExpressionpushGetResultSetFactoryExpressionpushMethodReferencepushPVSReferencepushThisAsActivation

Field Detail

closeActivationMethodback to summary
private MethodBuilder closeActivationMethod
cursorResultSetFieldback to summary
private LocalField cursorResultSetField
targetResultSetFieldback to summary
private LocalField targetResultSetField

Constructor Detail

ActivationClassBuilderback to summary
pack-priv ActivationClassBuilder(String superClass, CompilerContext cc) throws StandardException

By the time this is done, it has constructed the following class:

    final public class #className extends #superClass {
		// public void reset() { return; }
		protected ResultSet doExecute() throws StandardException {
			// statements must be added here
		}
      public #className() { super(); }
    }
 
Exceptions
StandardException:
thrown on failure

Method Detail

addCursorPositionCodeback to summary
pack-priv 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;
  }
 
finishExecuteMethodback to summary
pack-priv void finishExecuteMethod()

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

getBaseClassNameback to summary
pack-priv String getBaseClassName()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getBaseClassName.

The base class for activations is BaseActivation

getCloseActivationMethodback to summary
pack-priv MethodBuilder getCloseActivationMethod()
getCurrentSetupback to summary
protected LocalField getCurrentSetup()

Overrides org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getCurrentSetup.

Annotations
@Override
getPackageNameback to summary
public String getPackageName()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getPackageName.

Get the package name that this generated class lives in

Returns:String

package name

getRowCountback to summary
public int getRowCount() throws StandardException

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.getRowCount.

Get the number of ExecRows to allocate

Returns:int

package name

Exceptions
StandardException:
thrown on failure
rememberCursorback to summary
pack-priv 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.
rememberCursorTargetback to summary
pack-priv 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#)
setNumSubqueriesback to summary
public void setNumSubqueries()

Implements abstract org.apache.derby.impl.sql.compile.ExpressionClassBuilder.setNumSubqueries.

Generate the assignment for numSubqueries = x

Exceptions
StandardException:
thrown on failure
startResetMethodback to summary
pack-priv MethodBuilder startResetMethod()