Package org.apache.derby.iapi.sql.compile

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


    else if (!(castOperand instanceof UntypedNullConstantNode))
    {
      /*
      ** Make sure we can assign the two classes
      */
      TypeCompiler tc = castOperand.getTypeCompiler();
      if (! tc.convertible(getTypeId(), forDataTypeFunction))
      {
        throw StandardException.newException(SQLState.LANG_INVALID_CAST,
            sourceCTI.getSQLTypeName(),
                        getTypeId().getSQLTypeName());
      }
View Full Code Here


  public void compatible(ValueNode leftOperand) throws StandardException
  {
    int       size = size();
    TypeId  leftType;
    ValueNode    valueNode;
    TypeCompiler leftTC;

    leftType = leftOperand.getTypeId();
    leftTC = leftOperand.getTypeCompiler();

    for (int index = 0; index < size; index++)
    {
      valueNode = (ValueNode) elementAt(index);
      if (valueNode.requiresTypeFromContext())
        continue;


      /*
      ** Are the types compatible to each other?  If not, throw an exception.
      */
      if (! leftTC.compatible(valueNode.getTypeId()))
      {
        throw StandardException.newException(SQLState.LANG_DB2_COALESCE_DATATYPE_MISMATCH,
            leftType.getSQLTypeName(),
            valueNode.getTypeId().getSQLTypeName()
            );
View Full Code Here

  }

  /* cast arg to a varchar */
  protected ValueNode castArgToString(ValueNode vn) throws StandardException
  {
    TypeCompiler vnTC = vn.getTypeCompiler();
    if (! vn.getTypeId().isStringTypeId())
    {
      DataTypeDescriptor dtd = DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, true,
                  vnTC.getCastToCharWidth(
                        vn.getTypeServices()));

      ValueNode newNode = (ValueNode)
            getNodeFactory().getNode(
              C_NodeTypes.CAST_NODE,
View Full Code Here

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

    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
View Full Code Here

      */
      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

            rightOperand.setCollationInfo(receiver.getTypeServices());     
        }

        bindToBuiltIn();

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

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

      if (correspondingTypeId.isLongConcatableTypeId() ||
        otherType.isLongConcatableTypeId())
        return false;

      TypeCompiler otherTC = getTypeCompiler(otherType);
      return (otherType.isBitTypeId() ||
          (otherType.userType() &&
           otherTC.comparable(getTypeId(), forEquals, cf)));
        }
View Full Code Here

  public boolean numberComparable(TypeId otherType,
                  boolean forEquals,
                  ClassFactory cf)
  {
    TypeCompiler otherTC = getTypeCompiler(otherType);

    /* Numbers can be compared to other numbers,
     * boolean and objects
     */
    return otherType.isNumericTypeId() ||
        otherType.isBooleanTypeId() ||
        (otherType.userType() && otherTC.comparable(otherType,
                              forEquals,
                              cf));
  }
View Full Code Here

        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

            case java.sql.Types.INTEGER:
            case java.sql.Types.BIGINT:
            case java.sql.Types.REAL:
            case java.sql.Types.DOUBLE:
              if (routineInfo != null) {
                TypeCompiler tc = getTypeCompiler(ctid);
                return tc.getCorrespondingPrimitiveTypeName();
              }
              // fall through
            default:
              return ctid.getCorrespondingJavaTypeName();
            }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.compile.TypeCompiler

Copyright © 2018 www.massapicom. 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.