Examples of DataValueFactory


Examples of org.apache.derby.iapi.types.DataValueFactory

    RowLocation        rl = null;
    RowLocation        scanRL = null;
    ScanController      scan = null;
    int[]          baseColumnPositions;
    int            baseColumns = 0;
    DataValueFactory    dvf;
    long          indexRows;
    ConglomerateController  baseCC = null;
    ConglomerateController  indexCC = null;
    SchemaDescriptor    sd;
    ConstraintDescriptor  constraintDesc;
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

            invalidOperandType();
        }
      
        if( operand instanceof ConstantNode)
        {
            DataValueFactory dvf = getLanguageConnectionContext().getDataValueFactory();
            DataValueDescriptor sourceValue = ((ConstantNode) operand).getValue();
            DataValueDescriptor destValue;
            if( sourceValue.isNull())
            {
                destValue = (TIMESTAMP_METHOD_NAME.equals( methodName))
                ? dvf.getNullTimestamp( (DateTimeDataValue) null)
                : dvf.getNullDate( (DateTimeDataValue) null);
            }
            else
            {
                destValue = (TIMESTAMP_METHOD_NAME.equals( methodName))
                  ? dvf.getTimestamp( sourceValue) : dvf.getDate( sourceValue);
            }

            return new UserTypeConstantNode(destValue, getContextManager());
        }
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

        //depending on the collation type.
        if (newValue instanceof StringDataValue)
        {
                    constant.setCollationInfo(resultColumnType);
                   
          DataValueFactory dvf = getDataValueFactory();
          newValue = ((StringDataValue)newValue).getValue(dvf.getCharacterCollator(
              constant.getTypeServices().getCollationType()));
          constant.setValue(newValue);
        }
      }
      if ( ! resultColumnType.getTypeId().equals(
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

  private DataValueDescriptor convertConstant(TypeId toTypeId, int maxWidth,
      DataValueDescriptor constantValue)
    throws StandardException
  {
    int formatId = toTypeId.getTypeFormatId();
    DataValueFactory dvf = getDataValueFactory();
    switch (formatId)
    {
      default:
      case StoredFormatIds.CHAR_TYPE_ID:
        return constantValue;

      case StoredFormatIds.VARCHAR_TYPE_ID:
        String sourceValue = constantValue.getString();
        int sourceWidth = sourceValue.length();
        int posn;

        /*
        ** If the input is already the right length, no normalization is
        ** necessary - just return the source.
        **
        */

        if (sourceWidth <= maxWidth)
        {
          if(formatId == StoredFormatIds.VARCHAR_TYPE_ID)
            return dvf.getVarcharDataValue(sourceValue);
        }

        /*
        ** Check whether any non-blank characters will be truncated.
        */
        for (posn = maxWidth; posn < sourceWidth; posn++)
        {
          if (sourceValue.charAt(posn) != ' ')
          {
            String typeName = null;
            if (formatId == StoredFormatIds.VARCHAR_TYPE_ID)
                typeName = TypeId.VARCHAR_NAME;
            throw StandardException.newException(SQLState.LANG_STRING_TRUNCATION,
                           typeName,
                           StringUtil.formatForPrint(sourceValue),
                           String.valueOf(maxWidth));
          }
        }

        if (formatId == StoredFormatIds.VARCHAR_TYPE_ID)
          return dvf.getVarcharDataValue(sourceValue.substring(0, maxWidth));

      case StoredFormatIds.LONGVARCHAR_TYPE_ID:
        //No need to check widths here (unlike varchar), since no max width
        return dvf.getLongvarcharDataValue(constantValue.getString());

    }
  }
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

    bootValidation(create, startParams);
   
    // boot the type factory before store to ensure any dynamically
    // registered types (DECIMAL) are there before logical undo recovery
        // might need them.
    DataValueFactory dvf = (DataValueFactory)
            Monitor.bootServiceModule(
                create,
                this,
        org.apache.derby.iapi.reference.ClassName.DataValueFactory,
                startParams);
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

            invalidOperandType();
        }
      
        if( operand instanceof ConstantNode)
        {
            DataValueFactory dvf = getLanguageConnectionContext().getDataValueFactory();
            DataValueDescriptor sourceValue = ((ConstantNode) operand).getValue();
            DataValueDescriptor destValue = null;
            if( sourceValue.isNull())
            {
                destValue = (TIMESTAMP_METHOD_NAME.equals( methodName))
                ? dvf.getNullTimestamp( (DateTimeDataValue) null)
                : dvf.getNullDate( (DateTimeDataValue) null);
            }
            else
            {
                destValue = (TIMESTAMP_METHOD_NAME.equals( methodName))
                  ? dvf.getTimestamp( sourceValue) : dvf.getDate( sourceValue);
            }
            return (ValueNode) getNodeFactory().getNode( C_NodeTypes.USERTYPE_CONSTANT_NODE,
                                                         destValue, getContextManager());
        }
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

        //depending on the collation type.
        if (newValue instanceof StringDataValue)
        {
                    constant.setCollationInfo(resultColumnType);
                   
          DataValueFactory dvf = getDataValueFactory();
          newValue = ((StringDataValue)newValue).getValue(dvf.getCharacterCollator(
              constant.getTypeServices().getCollationType()));
          constant.setValue(newValue);
        }
      }
      if ( ! resultColumnType.getTypeId().equals(
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

  private DataValueDescriptor convertConstant(TypeId toTypeId, int maxWidth,
      DataValueDescriptor constantValue)
    throws StandardException
  {
    int formatId = toTypeId.getTypeFormatId();
    DataValueFactory dvf = getDataValueFactory();
    switch (formatId)
    {
      default:
      case StoredFormatIds.CHAR_TYPE_ID:
        return constantValue;

      case StoredFormatIds.VARCHAR_TYPE_ID:
        String sourceValue = constantValue.getString();
        int sourceWidth = sourceValue.length();
        int posn;

        /*
        ** If the input is already the right length, no normalization is
        ** necessary - just return the source.
        **
        */

        if (sourceWidth <= maxWidth)
        {
          if(formatId == StoredFormatIds.VARCHAR_TYPE_ID)
            return dvf.getVarcharDataValue(sourceValue);
        }

        /*
        ** Check whether any non-blank characters will be truncated.
        */
        for (posn = maxWidth; posn < sourceWidth; posn++)
        {
          if (sourceValue.charAt(posn) != ' ')
          {
            String typeName = null;
            if (formatId == StoredFormatIds.VARCHAR_TYPE_ID)
                typeName = TypeId.VARCHAR_NAME;
            throw StandardException.newException(SQLState.LANG_STRING_TRUNCATION,
                           typeName,
                           StringUtil.formatForPrint(sourceValue),
                           String.valueOf(maxWidth));
          }
        }

        if (formatId == StoredFormatIds.VARCHAR_TYPE_ID)
          return dvf.getVarcharDataValue(sourceValue.substring(0, maxWidth));

      case StoredFormatIds.LONGVARCHAR_TYPE_ID:
        //No need to check widths here (unlike varchar), since no max width
        return dvf.getLongvarcharDataValue(constantValue.getString());

    }
  }
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

        //depending on the collation type.
        if (newValue instanceof StringDataValue)
        {
                    constant.setCollationInfo(resultColumnType);
                   
          DataValueFactory dvf = getDataValueFactory();
          newValue = ((StringDataValue)newValue).getValue(dvf.getCharacterCollator(
              constant.getTypeServices().getCollationType()));
          constant.setValue(newValue);
        }
      }
      if ( ! resultColumnType.getTypeId().equals(
View Full Code Here

Examples of org.apache.derby.iapi.types.DataValueFactory

  private DataValueDescriptor convertConstant(TypeId toTypeId, int maxWidth,
      DataValueDescriptor constantValue)
    throws StandardException
  {
    int formatId = toTypeId.getTypeFormatId();
    DataValueFactory dvf = getDataValueFactory();
    switch (formatId)
    {
      default:
      case StoredFormatIds.CHAR_TYPE_ID:
        return constantValue;

      case StoredFormatIds.VARCHAR_TYPE_ID:
        String sourceValue = constantValue.getString();
        int sourceWidth = sourceValue.length();
        int posn;

        /*
        ** If the input is already the right length, no normalization is
        ** necessary - just return the source.
        **
        */

        if (sourceWidth <= maxWidth)
        {
          if(formatId == StoredFormatIds.VARCHAR_TYPE_ID)
            return dvf.getVarcharDataValue(sourceValue);
        }

        /*
        ** Check whether any non-blank characters will be truncated.
        */
        for (posn = maxWidth; posn < sourceWidth; posn++)
        {
          if (sourceValue.charAt(posn) != ' ')
          {
            String typeName = null;
            if (formatId == StoredFormatIds.VARCHAR_TYPE_ID)
                typeName = TypeId.VARCHAR_NAME;
            throw StandardException.newException(SQLState.LANG_STRING_TRUNCATION,
                           typeName,
                           StringUtil.formatForPrint(sourceValue),
                           String.valueOf(maxWidth));
          }
        }

        if (formatId == StoredFormatIds.VARCHAR_TYPE_ID)
          return dvf.getVarcharDataValue(sourceValue.substring(0, maxWidth));

      case StoredFormatIds.LONGVARCHAR_TYPE_ID:
        //No need to check widths here (unlike varchar), since no max width
        return dvf.getLongvarcharDataValue(constantValue.getString());

    }
  }
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.