Examples of TypeCompiler


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())
    {
      DataTypeDescriptor dtd = DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, true,
                  vnTC.getCastToCharWidth(
                        vn.getTypeServices()));
      // DERBY-2910 - Match current schema collation for implicit cast as we do for
      // explicit casts per SQL Spec 6.12 (10)                                 
      dtd.setCollationType(getSchemaDescriptor(null).getCollationType());
      dtd.setCollationDerivation(StringDataValue.COLLATION_DERIVATION_IMPLICIT);
View Full Code Here

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

            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

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();
              }
              break;
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

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

            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

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

              TypeId  ctid = mapToTypeID( jsqlType );

              if ((ctid.isNumericTypeId() && !ctid.isDecimalTypeId()) || ctid.isBooleanTypeId())
              {
                TypeCompiler tc = getTypeCompiler(ctid);
                primParmTypeNames[i] = tc.getCorrespondingPrimitiveTypeName();
                if ( castToPrimitiveAsNecessary) { methodParms[i].castToPrimitive(true); }
              }
              else { primParmTypeNames[i] = ctid.getCorrespondingJavaTypeName(); }
            }
View Full Code Here

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(destCTI, forDataTypeFunction))
      {
        throw StandardException.newException(SQLState.LANG_INVALID_CAST,
            sourceCTI.getSQLTypeName(),
            destCTI.getSQLTypeName());
      }
View Full Code Here

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

  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

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

  public void comparable(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);

      /*
      ** Can the types be compared to each other?  If not, throw an
      ** exception.
      */
      if (! leftTC.comparable(valueNode.getTypeId(),
                  false,
                  getClassFactory()))
      {
        throw StandardException.newException(SQLState.LANG_NOT_COMPARABLE,
            leftType.getSQLTypeName(),
View Full Code Here

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

  public boolean comparable(TypeId otherType,
                              boolean forEquals,
                              ClassFactory cf)
  {
    int otherJDBCTypeId = otherType.getJDBCTypeId();
    TypeCompiler otherTC = getTypeCompiler(otherType);

    // Long types cannot be compared
    if (otherType.isLongConcatableTypeId())
      return false;

    if (otherJDBCTypeId == Types.DATE || otherType.isStringTypeId())
      return true;

    /* User types know the rules for what can be compared to them */
    if (otherType.userType())
    {
      return otherTC.comparable(getTypeId(), forEquals, cf);
    }

    return false;
  }
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.