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

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


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

            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

              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

  }

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

    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

    ** YEAR, MONTH or DAY and to TIME if extracting HOUR, MINUTE or
    ** SECOND.
    */
    if (opTypeId.isStringTypeId())
    {
            TypeCompiler tc = operand.getTypeCompiler();
      int castType = (extractField < 3) ? Types.DATE : Types.TIME;
            operand = new CastNode(
          operand,
          DataTypeDescriptor.getBuiltInDataTypeDescriptor(castType, true,
                    tc.getCastToCharWidth(
                        operand.getTypeServices())),
          getContextManager());
      ((CastNode) operand).bindCastNodeOnly();

      opTypeId = operand.getTypeId();
View Full Code Here

   *
   */
    void compatible(ValueNode leftOperand) throws StandardException
  {
        TypeId leftType = leftOperand.getTypeId();
        TypeCompiler leftTC = leftOperand.getTypeCompiler();

        for (ValueNode valueNode : this)
    {
            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

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

      TypeId compType = inputType.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(
                        inputType, inputType, getOperator());
        /*
        ** SUM and AVG may return null
        */
        return outDts.getNullabilityType(true);
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.