| java.lang.Object org.apache.derby.impl.sql.compile.ExpressionClassBuilder
All known Subclasses: org.apache.derby.impl.sql.compile.ActivationClassBuilder,
ExpressionClassBuilder | abstract class ExpressionClassBuilder implements ExpressionClassBuilderInterface(Code) | | ExpressionClassBuilder
provides an interface to satisfy generation's
common tasks in building classes that involve expressions.
This is the common superclass of ActivationClassBuilder and
FilterClassBuilder. See the documentation on ActivationClassBuilder.
author: Rick Extracted out of ActivationClassBuilder |
Method Summary | |
FormatableArrayHolder | addColumnToOrdering(FormatableArrayHolder orderingHolder, int columnNum) Add a column to the existing Ordering list. | int | addItem(Object o) | abstract MethodBuilder | beginExecuteMethod() | void | finishConstructor() Finish the constructor by newing the array of Rows and putting a return
at the end of it. | abstract void | finishExecuteMethod(boolean genMarkAsTopNode) Finish up the Execute method. | void | generateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field) Generate a data value. | void | generateNull(MethodBuilder mb, TypeCompiler tc) Generate a Null data value. | void | generateNullWithExpress(MethodBuilder mb, TypeCompiler tc) Generate a Null data value. | abstract String | getBaseClassName() Return the base class of the activation's hierarchy
(the subclass of Object).
This class is expected to hold methods used by all
compilation code, such as datatype compilation code,
e.g. | ClassBuilder | getClassBuilder() | FormatableArrayHolder | getColumnOrdering(ResultColumnList rclist) These utility methods buffers compilation from the IndexColumnOrder
class. | FormatableArrayHolder | getColumnOrdering(OrderedColumnList oclist) | MethodBuilder | getConstructor() | void | getCurrentDateExpression(MethodBuilder mb) This utility method returns an expression for CURRENT_DATE. | protected LocalField | getCurrentSetup() | void | getCurrentTimeExpression(MethodBuilder mb) This utility method returns an expression for CURRENT_TIME. | void | getCurrentTimestampExpression(MethodBuilder mb) This utility method generates an expression for CURRENT_TIMESTAMP. | MethodBuilder | getExecuteMethod() The execute method returns a result set that will evaluate the
statement this activation class is the compiled form of. | GeneratedClass | getGeneratedClass(ByteArray savedBytes) Take the generated class, and turn it into an
actual class. | abstract String | getPackageName() Get the name of the package that the generated class will live in. | abstract int | getRowCount() | String | getRowLocationScanResultSetName() | protected TypeCompiler | getTypeCompiler(TypeId typeId) | MethodBuilder | newExprFun() "ExprFun"s are the "expression functions" that
are specific to a given JSQL statement. | LocalField | newFieldDeclaration(int modifiers, String type, String name) Add a field declaration to the generated class
Parameters: modifiers - The | of the modifier values such as public, static, etc. Parameters: type - The type of the field in java language. Parameters: name - The name of the field. | LocalField | newFieldDeclaration(int modifiers, String type) Add an arbitrarily named field to the generated class.
This is used to generate fields where the caller doesn't care what
the field is named. | MethodBuilder | newGeneratedFun(String returnType, int modifiers) Activations might have need of internal functions
that are not used by the result sets, but by other
activation functions. | MethodBuilder | newGeneratedFun(String returnType, int modifiers, String[] params) | String | newRowLocationScanResultSetName() generates a variable name for the rowscanresultset. | MethodBuilder | newUserExprFun() Start a user expression. | void | pushColumnReference(MethodBuilder mb, int rsNumber, int colId) Generate a reference to a colunm in a result set. | void | pushDataValueFactory(MethodBuilder mb) | void | pushGetExecutionFactoryExpression(MethodBuilder mb) | void | pushGetResultSetFactoryExpression(MethodBuilder mb) | void | pushMethodReference(MethodBuilder mb, MethodBuilder exprMethod) Push an expression that is a GeneratedMethod reference to the
passed in method. | void | pushPVSReference(MethodBuilder mb) Generate a reference to the parameter value
set that all activations use. | void | pushThisAsActivation(MethodBuilder mb) Get a "this" expression declared as an Activation. | abstract void | setNumSubqueries() |
currentDatetimeFieldName | final protected static String currentDatetimeFieldName(Code) | | |
nextExprNum | protected int nextExprNum(Code) | | |
nextFieldNum | protected int nextFieldNum(Code) | | |
nextNonFastExpr | protected int nextNonFastExpr(Code) | | |
addColumnToOrdering | FormatableArrayHolder addColumnToOrdering(FormatableArrayHolder orderingHolder, int columnNum)(Code) | | Add a column to the existing Ordering list. Takes
a column id and only adds it if it isn't in the list.
the ColumnOrdering array |
finishConstructor | void finishConstructor() throws StandardException(Code) | | Finish the constructor by newing the array of Rows and putting a return
at the end of it.
exception: StandardException - thrown on failure |
generateDataValue | void generateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field)(Code) | | Generate a data value.
The value is to be set in the SQL data value is required
on the stack and will be popped, a SQL data value
is pushed.
|
generateNull | void generateNull(MethodBuilder mb, TypeCompiler tc)(Code) | | Generate a Null data value.
Nothing is required on the stack, a SQL null data value
is pushed.
|
generateNullWithExpress | void generateNullWithExpress(MethodBuilder mb, TypeCompiler tc)(Code) | | Generate a Null data value.
The express value is required on the stack and will be popped, a SQL null data value
is pushed.
|
getBaseClassName | abstract String getBaseClassName()(Code) | | Return the base class of the activation's hierarchy
(the subclass of Object).
This class is expected to hold methods used by all
compilation code, such as datatype compilation code,
e.g. getDataValueFactory.
|
getColumnOrdering | FormatableArrayHolder getColumnOrdering(ResultColumnList rclist)(Code) | | These utility methods buffers compilation from the IndexColumnOrder
class.
They create an ordering based on their parameter, stuff that into
the prepared statement, and then return the entry # for
use in the generated code.
We could write another utility method to generate code to
turn an entry # back into an object, but so far no-one needs it.
WARNING: this is a crafty method that ASSUMES that
you want every column in the list ordered, and that every
column in the list is the entire actual result colunm.
It is only useful for DISTINCT in select.
|
getCurrentDateExpression | void getCurrentDateExpression(MethodBuilder mb)(Code) | | This utility method returns an expression for CURRENT_DATE.
Get the expression this way, because the activation needs to
generate support information for CURRENT_DATE,
that would otherwise be painful to create manually.
|
getCurrentTimeExpression | void getCurrentTimeExpression(MethodBuilder mb)(Code) | | This utility method returns an expression for CURRENT_TIME.
Get the expression this way, because the activation needs to
generate support information for CURRENT_TIME,
that would otherwise be painful to create manually.
|
getCurrentTimestampExpression | void getCurrentTimestampExpression(MethodBuilder mb)(Code) | | This utility method generates an expression for CURRENT_TIMESTAMP.
Get the expression this way, because the activation needs to
generate support information for CURRENT_TIMESTAMP,
that would otherwise be painful to create manually.
|
getExecuteMethod | MethodBuilder getExecuteMethod()(Code) | | The execute method returns a result set that will evaluate the
statement this activation class is the compiled form of.
REVISIT: do we need to give the caller the ability to touch it
directly, or could we wrap the alterations to it in this class?
|
getGeneratedClass | GeneratedClass getGeneratedClass(ByteArray savedBytes) throws StandardException(Code) | | Take the generated class, and turn it into an
actual class.
This method assumes, does not check, that
the class and its parts are all complete.
Parameters: savedBytes - place to save generated bytes.if null, it is ignored exception: StandardException - thrown when exception occurs |
getPackageName | abstract String getPackageName()(Code) | | Get the name of the package that the generated class will live in.
name of package that the generated class will live in. |
getRowCount | abstract int getRowCount() throws StandardException(Code) | | Get the number of ExecRows that must be allocated
number of ExecRows that must be allocated exception: StandardException - thrown on failure |
getRowLocationScanResultSetName | String getRowLocationScanResultSetName()(Code) | | |
getTypeCompiler | protected TypeCompiler getTypeCompiler(TypeId typeId)(Code) | | Get the TypeCompiler associated with the given TypeId
Parameters: typeId - The TypeId to get a TypeCompiler for The corresponding TypeCompiler |
newExprFun | MethodBuilder newExprFun()(Code) | | "ExprFun"s are the "expression functions" that
are specific to a given JSQL statement. For example,
an ExprFun is generated to evaluate the where clause
of a select statement and return a boolean result.
All methods return by this are expected to be called
via the GeneratedMethod interface. Thus the methods
are public and return java.lang.Object.
Once the exprfun has been created, the
caller will need to add statements to it,
minimally a return statement.
ExprFuns return Object types, since they
are invoked through reflection and thus their
return type would get wrapped in an object anyway.
For example: return java.lang.Boolean, not boolean.
|
newFieldDeclaration | LocalField newFieldDeclaration(int modifiers, String type, String name)(Code) | | Add a field declaration to the generated class
Parameters: modifiers - The | of the modifier values such as public, static, etc. Parameters: type - The type of the field in java language. Parameters: name - The name of the field. None. |
newFieldDeclaration | LocalField newFieldDeclaration(int modifiers, String type)(Code) | | Add an arbitrarily named field to the generated class.
This is used to generate fields where the caller doesn't care what
the field is named. It is especially useful for generating arbitrary
numbers of fields, where the caller doesn't know in advance how many
fields will be used. For example, it is used for generating fields
to hold intermediate values from expressions.
Parameters: modifiers - The | of the modifier values such as public, static, etc. Parameters: type - The type of the field in java language. The name of the new field |
newGeneratedFun | MethodBuilder newGeneratedFun(String returnType, int modifiers)(Code) | | Activations might have need of internal functions
that are not used by the result sets, but by other
activation functions. Thus, we make it possible
for functions to be generated directly as well
as through the newExprFun interface. newExprFun
should be used when a static field pointing to the
expression function is needed.
The generated function will generally have a generated name
that can be viewed through the MethodBuilder interface.
This name is generated to ensure uniqueness from other
function names in the activation class. If you pass in a function
name, think carefully about whether it will collide with other names.
Parameters: returnType - the return type of the function Parameters: modifiers - the modifiers on the function See Also: ExpressionClassBuilder.newExprFun |
newRowLocationScanResultSetName | String newRowLocationScanResultSetName()(Code) | | generates a variable name for the rowscanresultset.
This can not be a fixed name because in cases like
cascade delete same activation class will be dealing
more than one RowScanResultSets for dependent tables.
|
newUserExprFun | MethodBuilder newUserExprFun()(Code) | | Start a user expression. The difference between a normal expression
(returned by newExprFun)
and a user expression is that a user expression catches all exceptions
(because we don't want random exceptions thrown from user methods to
propagate to the rest of the system.
A new MethodBuilder |
pushColumnReference | void pushColumnReference(MethodBuilder mb, int rsNumber, int colId)(Code) | | Generate a reference to a colunm in a result set.
Parameters: rsNumber - the result set number Parameters: colId - the column number |
pushGetExecutionFactoryExpression | void pushGetExecutionFactoryExpression(MethodBuilder mb)(Code) | | |
pushGetResultSetFactoryExpression | void pushGetResultSetFactoryExpression(MethodBuilder mb)(Code) | | |
pushMethodReference | void pushMethodReference(MethodBuilder mb, MethodBuilder exprMethod)(Code) | | Push an expression that is a GeneratedMethod reference to the
passed in method. aka. a "function pointer".
|
pushPVSReference | void pushPVSReference(MethodBuilder mb)(Code) | | Generate a reference to the parameter value
set that all activations use.
|
pushThisAsActivation | void pushThisAsActivation(MethodBuilder mb)(Code) | | Get a "this" expression declared as an Activation.
This is the commonly used type of the this expression.
|
|
|