Examples of TypeCompiler


Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

      }
    }

    bindToBuiltIn();

    TypeCompiler receiverTC = receiver.getTypeCompiler();
    TypeCompiler leftTC = leftOperand.getTypeCompiler();

    /* The receiver must be a string type
     */
    if (! receiver.getTypeId().isStringTypeId())
    {
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

   */
  public void generateExpression(ExpressionClassBuilder acb,
                      MethodBuilder mb)
                  throws StandardException {

    TypeCompiler    tc = getTypeCompiler();
        String fieldType = tc.interfaceName();

    /*
    ** NOTE: DO NOT CALL THE CONSTRUCTOR TO GENERATE ANYTHING.  IT HAS
    ** A DIFFERENT value FIELD.
    */
 
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

      TypeId compType = dts.getTypeId();
   
      CompilerContext cc = (CompilerContext)
        ContextService.getContext(CompilerContext.CONTEXT_ID);
      TypeCompilerFactory tcf = cc.getTypeCompilerFactory();
      TypeCompiler tc = tcf.getTypeCompiler(compType);
   
      /*
      ** If the class implements NumberDataValue, then we
      ** are in business.  Return type is same as input
      ** type.
      */
      if (compType.isNumericTypeId())
      {
        aggregatorClass.append(getAggregatorClassName());

        DataTypeDescriptor outDts = tc.resolveArithmeticOperation(
                              dts, dts, getOperator());
        /*
        ** SUM and AVG may return null
        */
        outDts.setNullability(true);
 
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

      throws StandardException
  {
    super.bindExpression(fromList, subqueryList, aggregateVector);

//RESOLVELOCALIZE - convert constants to national constants
    TypeCompiler leftTC = leftOperand.getTypeCompiler();
    TypeCompiler rightTC = rightOperand.getTypeCompiler();
    TypeId leftTypeId = leftOperand.getTypeId();
    TypeId rightTypeId = rightOperand.getTypeId();

    /*
     * If we are comparing a non-string with a string type, then we
     * must prevent the non-string value from being used to probe into
     * an index on a string column. This is because the string types
     * are all of low precedence, so the comparison rules of the non-string
     * value are used, so it may not find values in a string index because
     * it will be in the wrong order. So, cast the string value to its
     * own type. This is easier than casting it to the non-string type,
     * because we would have to figure out the right length to cast it to.
     */
    if (! leftTypeId.isStringTypeId() && rightTypeId.isStringTypeId())
    {
      DataTypeDescriptor rightTypeServices = rightOperand.getTypeServices();

      rightOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          rightOperand,
          new DataTypeDescriptor(
              rightTypeId,
              true,
              rightTypeServices.getMaximumWidth()),
          getContextManager());
      ((CastNode) rightOperand).bindCastNodeOnly();
    }
    else if (! rightTypeId.isStringTypeId() && leftTypeId.isStringTypeId())
    {
      DataTypeDescriptor leftTypeServices = leftOperand.getTypeServices();

      leftOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          leftOperand,
          new DataTypeDescriptor(
              leftTypeId,
              true,
              leftTypeServices.getMaximumWidth()),
          getContextManager());
      ((CastNode) leftOperand).bindCastNodeOnly();
    }
    /* If we are comparing a char with a national char then
     * we need to generate a cast to the appropriate national
     * char above the char operand.
     */
    else if (! leftTypeId.isNationalStringTypeId() &&
      rightTypeId.isNationalStringTypeId())
    {
      leftOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          leftOperand,
          DataTypeDescriptor.getBuiltInDataTypeDescriptor(leftTC.getMatchingNationalCharTypeName(),
                    leftTC.getCastToCharWidth(
                      leftOperand.getTypeServices())),
          getContextManager());
      ((CastNode) leftOperand).bindCastNodeOnly();
    }
    else if (! rightTypeId.isNationalStringTypeId() &&
        leftTypeId.isNationalStringTypeId())
    {
      rightOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          rightOperand,
          DataTypeDescriptor.getBuiltInDataTypeDescriptor(rightTC.getMatchingNationalCharTypeName(),
                    rightTC.getCastToCharWidth(
                      rightOperand.getTypeServices())),
          getContextManager());
      ((CastNode) rightOperand).bindCastNodeOnly();
    }

View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

      */
      mb.startElseCode();
    }
   
    resultType = getTypeId();
    TypeCompiler tc = getTypeCompiler();

    resultTypeName = tc.interfaceName();

    /* Allocate an object for re-use to hold the result of the conversion */
    LocalField field = acb.newFieldDeclaration(Modifier.PRIVATE, resultTypeName);

    /* Generate the expression for the Java value under us */
 
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

    /*
     * If either the left or right operands are non-string, non-bit types,
     * then we generate an implicit cast to VARCHAR.
     */
    TypeCompiler tc = leftOperand.getTypeCompiler();
    if (!(leftOperand.getTypeId().isStringTypeId() || leftOperand
        .getTypeId().isBitTypeId())) {
      leftOperand = (ValueNode) getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          leftOperand,
          DataTypeDescriptor.getBuiltInDataTypeDescriptor(
              Types.VARCHAR, true, tc
                  .getCastToCharWidth(leftOperand
                      .getTypeServices())),
          getContextManager());
      ((CastNode) leftOperand).bindCastNodeOnly();
    }
    tc = rightOperand.getTypeCompiler();
    if (!(rightOperand.getTypeId().isStringTypeId() || rightOperand
        .getTypeId().isBitTypeId())) {
      rightOperand = (ValueNode) getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          rightOperand,
          DataTypeDescriptor.getBuiltInDataTypeDescriptor(
              Types.VARCHAR, true, tc
                  .getCastToCharWidth(rightOperand
                      .getTypeServices())),
          getContextManager());
      ((CastNode) rightOperand).bindCastNodeOnly();
    }

    /*
     * * Set the result type of this operator based on the operands. * By
     * convention, the left operand gets to decide the result type * of a
     * binary operator.
     */
    tc = leftOperand.getTypeCompiler();
    setType(resolveConcatOperation(leftOperand.getTypeServices(),
        rightOperand.getTypeServices()));

    /*
     * * Make sure the maximum width set for the result doesn't exceed the
     * result type's maximum width
     */
    if (SanityManager.DEBUG) {
      if (getTypeServices().getMaximumWidth() > getTypeId()
          .getMaximumMaximumWidth()) {
        SanityManager
            .THROWASSERT("The maximum length "
                + getTypeServices().getMaximumWidth()
                + " for the result type "
                + getTypeId().getSQLTypeName()
                + " can't be greater than it's maximum width of result's typeid"
                + getTypeId().getMaximumMaximumWidth());
      }
    }

    /*
     * * Now that we know the target interface type, set it. This assumes *
     * that both operands have the same interface type, which is a safe *
     * assumption for the concatenation operator.
     */
    this.setLeftRightInterfaceType(tc.interfaceName());

    return this;
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

              receiver.getTypeServices().getCollationType());             
        }

        bindToBuiltIn();

        TypeCompiler receiverTC = receiver.getTypeCompiler();
        TypeCompiler leftTC     = leftOperand.getTypeCompiler();

        /* The receiver must be a string type
        */
        if (! receiver.getTypeId().isStringTypeId())
        {
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

  }

  /* cast arg to a varchar */
  protected ValueNode castArgToString(ValueNode vn) throws StandardException
  {
    TypeCompiler vnTC = vn.getTypeCompiler();
    if (! vn.getTypeId().isStringTypeId())
    {
      ValueNode newNode = (ValueNode)
            getNodeFactory().getNode(
              C_NodeTypes.CAST_NODE,
              vn,
              DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, true,
                              vnTC.getCastToCharWidth(
                                  vn.getTypeServices())),
              getContextManager());
      ((CastNode) newNode).bindCastNodeOnly();
      return newNode;
    }
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

        case java.sql.Types.SMALLINT:
        case java.sql.Types.INTEGER:
        case java.sql.Types.BIGINT:
        case java.sql.Types.REAL:
        case java.sql.Types.DOUBLE:
          TypeCompiler tc = getTypeCompiler(returnTypeId);
          requiredType = tc.getCorrespondingPrimitiveTypeName();
          if (!routineInfo.calledOnNullInput() && routineInfo.getParameterCount() != 0)
          {
            promoteName = returnTypeId.getCorrespondingJavaTypeName();
          }
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.TypeCompiler

       
          // how about the primitive name
      if ((paramTypeId.isNumericTypeId() && !paramTypeId.isDecimalTypeId())
          || paramTypeId.isBooleanTypeId())
      {
        TypeCompiler tc = getTypeCompiler(paramTypeId);
        if (type.equals(tc.getCorrespondingPrimitiveTypeName()))
        {
               signatureTypes[count - 1] = type;
              continue;         
        }
      }
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.