Examples of MethodBuilder


Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    throws StandardException
  {
    // this sets up the method and the static field.
    // generates:
    //   java.lang.Object userExprFun( ) { }
    MethodBuilder userExprFun = ecb.newUserExprFun();

        /* Push the the current row onto the stack. */
        userExprFun.pushThis();
        userExprFun.push( rsNumber );
        userExprFun.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "getCurrentRow", ClassName.Row, 1);

    // 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.dup();       // instance (current row)
            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;
  }
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

  private int getScanArguments(ExpressionClassBuilder acb,
                      MethodBuilder mb)
    throws StandardException
  {
        // get a function to allocate scan rows of the right shape and size
         MethodBuilder resultRowAllocator =
            resultColumns.generateHolderMethod(acb,
                          referencedCols,
                          (FormatableBitSet) null);

    // pass in the referenced columns on the saved objects
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    {
         mb.pushNull(ClassName.GeneratedMethod);
    }
    else
    {
      MethodBuilder  userExprFun = generateCheckConstraints(checkConstraints, ecb);

         // check constraint is used in the final result set
      // as an access of the new static
         // field holding a reference to this new method.
         ecb.pushMethodReference(mb, userExprFun);
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    throws StandardException
  {
    // this sets up the method and the static field.
    // generates:
    //   java.lang.Object userExprFun { }
    MethodBuilder userExprFun = ecb.newUserExprFun();
   
    // check constraint knows it is returning its value;
   
    /* generates:
     *    return <checkExpress.generate(ecb)>;
     * and adds it to userExprFun
     */

    checkConstraints.generateExpression(ecb, userExprFun);
    userExprFun.methodReturn();
   
    // we are done modifying userExprFun, complete it.
    userExprFun.complete();

    return userExprFun;
  }
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    {
         mb.pushNull(ClassName.GeneratedMethod);
    }
    else
    {
      MethodBuilder  userExprFun = generateGenerationClauses( rcl, resultSetNumber, isUpdate, ecb);

         // generation clause evaluation is used in the final result set
      // as an access of the new static
         // field holding a reference to this new method.
         ecb.pushMethodReference(mb, userExprFun);
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    throws StandardException
  {
    // this sets up the method and the static field.
    // generates:
    //   java.lang.Object userExprFun( ) { }
    MethodBuilder userExprFun = ecb.newUserExprFun();

        /* Push the the current row onto the stack. */
        userExprFun.pushThis();
        userExprFun.push( rsNumber );
        userExprFun.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "getCurrentRow", ClassName.Row, 1);

    // 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.dup();       // instance (current row)
            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;
  }
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    {
         mb.pushNull(ClassName.GeneratedMethod);
    }
    else
    {
      MethodBuilder  userExprFun = generateCheckConstraints(checkConstraints, ecb);

         // check constraint is used in the final result set
      // as an access of the new static
         // field holding a reference to this new method.
         ecb.pushMethodReference(mb, userExprFun);
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    throws StandardException
  {
    // this sets up the method and the static field.
    // generates:
    //   java.lang.Object userExprFun { }
    MethodBuilder userExprFun = ecb.newUserExprFun();
   
    // check constraint knows it is returning its value;
   
    /* generates:
     *    return <checkExpress.generate(ecb)>;
     * and adds it to userExprFun
     */

    checkConstraints.generateExpression(ecb, userExprFun);
    userExprFun.methodReturn();
   
    // we are done modifying userExprFun, complete it.
    userExprFun.complete();

    return userExprFun;
  }
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    {
         mb.pushNull(ClassName.GeneratedMethod);
    }
    else
    {
      MethodBuilder  userExprFun = generateGenerationClauses( rcl, resultSetNumber, isUpdate, ecb);

         // generation clause evaluation is used in the final result set
      // as an access of the new static
         // field holding a reference to this new method.
         ecb.pushMethodReference(mb, userExprFun);
View Full Code Here

Examples of org.apache.derby.iapi.services.compiler.MethodBuilder

    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;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.