throws StandardException
{
// this sets up the method and the static field.
// generates:
// java.lang.Object userExprFun( ) { }
MethodBuilder userExprFun = ecb.newUserExprFun();
/* Declare the field and load it with the current row */
LocalField field = ecb.newFieldDeclaration(Modifier.PRIVATE, ClassName.ExecRow);
userExprFun.pushThis();
userExprFun.push( rsNumber );
userExprFun.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "getCurrentRow", ClassName.Row, 1);
userExprFun.putField( field );
// Loop through the result columns, computing generated columns
// as we go.
int size = rcl.size();
int startColumn = 0;
// For UPDATEs, we only compute the updated value for the
// column. The updated value lives in the second half of the row.
// This means we ignore the first half of the row, which holds
// the before-images of the columns.
if ( isUpdate )
{
// throw away the last cell in the row, which is the row id
startColumn = size - 1;
startColumn = startColumn / 2;
}
for ( int i = startColumn; i < size; i++ )
{
ResultColumn rc = (ResultColumn) rcl.elementAt( i );
if ( !rc.hasGenerationClause() ) { continue; }
userExprFun.getField(field); // instance
userExprFun.push(i + 1); // arg1
rc.generateExpression(ecb, userExprFun);
userExprFun.cast(ClassName.DataValueDescriptor);
userExprFun.callMethod(VMOpcode.INVOKEINTERFACE, ClassName.Row, "setColumn", "void", 2);
}
/* generates:
* return;
* And adds it to userExprFun
*/
userExprFun.methodReturn();
// we are done modifying userExprFun, complete it.
userExprFun.complete();
return userExprFun;
}