Package org.apache.derby.iapi.types

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


                    TypeDescriptor.MAXIMUM_WIDTH_UNKNOWN));
    }
    else
    {
      Integer maxWidth = null;
      TypeId  typeId = null;

            if( arg1 instanceof DataValueDescriptor)
                dvd = (DataValueDescriptor) arg1;
      if (arg1 instanceof Date
                || (dvd != null && dvd.getTypeFormatId() == StoredFormatIds.SQL_DATE_ID))
View Full Code Here


  {
        if( value instanceof DataValueDescriptor)
            return ((DataValueDescriptor) value).getClone();
       
    DataValueFactory      dvf = getDataValueFactory();
    TypeId      typeID = getTypeId();
    String            typeName = typeID.getSQLTypeName();

    if ( typeName.equals( TypeId.DATE_NAME ) )
    {
      return  new SQLDate((Date) value);
    }
View Full Code Here

                    TypeDescriptor.MAXIMUM_WIDTH_UNKNOWN));
    }
    else
    {
      Integer maxWidth = null;
      TypeId  typeId = null;

            if( arg1 instanceof DataValueDescriptor)
                dvd = (DataValueDescriptor) arg1;
      if (arg1 instanceof Date
                || (dvd != null && dvd.getTypeFormatId() == StoredFormatIds.SQL_DATE_ID))
View Full Code Here

  {
        if( value instanceof DataValueDescriptor)
            return ((DataValueDescriptor) value).getClone();
       
    DataValueFactory      dvf = getDataValueFactory();
    TypeId      typeID = getTypeId();
    String            typeName = typeID.getSQLTypeName();

    if ( typeName.equals( TypeId.DATE_NAME ) )
    {
      return  new SQLDate((Date) value);
    }
View Full Code Here

    {
      LanguageConnectionContext lcc = (LanguageConnectionContext)
        ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);

      DataTypeDescriptor dts = new DataTypeDescriptor( (DataTypeDescriptor)inputType, inputType.isNullable());
      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());
View Full Code Here

                getNodeFactory().doJoinOrderOptimization(),
                getContextManager()),
              (SubqueryList) null,
              (Vector) null);

      TypeId columnTypeId = (TypeId) dataTypeServices.getTypeId();
      TypeId defaultTypeId = defaultTree.getTypeId();

      // Check for 'invalid default' errors (42894)
      // before checking for 'not storable' errors (42821).
      if (!defaultTypeIsValid(columnTypeId, dataTypeServices,
          defaultTypeId, defaultTree, defaultNode.getDefaultText()))
      {
          throw StandardException.newException(
            SQLState.LANG_DB2_INVALID_DEFAULT_VALUE,
            this.name);
      }

      // Now check 'not storable' errors.
      if (! getTypeCompiler(columnTypeId).
                storable(defaultTypeId, getClassFactory()))
      {
        throw StandardException.newException(SQLState.LANG_NOT_STORABLE,
          columnTypeId.getSQLTypeName(),
          defaultTypeId.getSQLTypeName() );
      }

      // Save off the default text
      // RESOLVEDEFAULT - Convert to constant if possible
      defaultInfo = new DefaultInfoImpl(false,
View Full Code Here

    String columnName;
    String defaultID;
    DefaultInfoImpl    defaultInfo = null;
    ColumnDescriptor colDesc;
    BaseTypeIdImpl    typeId;
    TypeId  wrapperTypeId;
    DataValueDescriptor  defaultValue = null;
    UUID        defaultUUID = null;
    UUID        uuid = null;
    UUIDFactory      uuidFactory = getUUIDFactory();
    long autoincStart, autoincInc;

    DataDescriptorGenerator  ddg = dd.getDataDescriptorGenerator();


    /*
    ** We're going to be getting the UUID for this sucka
    ** so make sure it is a UniqueTupleDescriptor.
    */
    if (parentTupleDescriptor != null)
    {
      if (SanityManager.DEBUG)
      {
        if (!(parentTupleDescriptor instanceof UniqueTupleDescriptor))
        {
          SanityManager.THROWASSERT(parentTupleDescriptor.getClass().getName()
              + " not instanceof UniqueTupleDescriptor")
        }
      }
      uuid = ((UniqueTupleDescriptor)parentTupleDescriptor).getUUID();
    }
    else
    {
      /* 1st column is REFERENCEID (char(36)) */
      uuid = uuidFactory.recreateUUID(row.getColumn(SYSCOLUMNS_REFERENCEID).
                          getString());
    }

    /* NOTE: We get columns 5 and 6 next in order to work around
     * a 1.3.0 HotSpot bug.  (#4361550)
     */

    // 5th column is COLUMNDEFAULT (serialiazable)
    Object object = row.getColumn(SYSCOLUMNS_COLUMNDEFAULT).getObject();
    if (object instanceof DataValueDescriptor)
    {
      defaultValue = (DataValueDescriptor) object;
    }
    else if (object instanceof DefaultInfoImpl)
    {
      defaultInfo = (DefaultInfoImpl) object;
      defaultValue = defaultInfo.getDefaultValue();
    }

    /* 6th column is DEFAULTID (char(36)) */
    defaultID = row.getColumn(SYSCOLUMNS_COLUMNDEFAULTID).getString();

    if (defaultID != null)
    {
      defaultUUID = uuidFactory.recreateUUID(defaultID);
    }

    /* 2nd column is COLUMNNAME (varchar(128)) */
    columnName = row.getColumn(SYSCOLUMNS_COLUMNNAME).getString();

    /* 3rd column is COLUMNNUMBER (int) */
    columnNumber = row.getColumn(SYSCOLUMNS_COLUMNNUMBER).getInt();

    /* 4th column is COLUMNDATATYPE */

    /*
    ** What is stored in the column is a TypeDescriptorImpl, which
    ** points to a BaseTypeIdImpl.  These are simple types that are
    ** intended to be movable to the client, so they don't have
    ** the entire implementation.  We need to wrap them in DataTypeServices
    ** and TypeId objects that contain the full implementations for
    ** language processing.
    */
    TypeDescriptorImpl typeDescriptor = (TypeDescriptorImpl) row.getColumn(SYSCOLUMNS_COLUMNDATATYPE).
                          getObject();
    typeId = typeDescriptor.getTypeId();

    /*
    ** The BaseTypeIdImpl tells what type of TypeId it is supposed to
    ** be wrapped in.
    */
    wrapperTypeId =
      (TypeId) Monitor.newInstanceFromIdentifier(typeId.wrapperTypeFormatId());
    /* Wrap the BaseTypeIdImpl in a full type id */
    wrapperTypeId.setNestedTypeId(typeId);

    /* Wrap the TypeDescriptorImpl in a full DataTypeDescriptor */
    DataTypeDescriptor dataTypeServices = new DataTypeDescriptor(typeDescriptor,
                          wrapperTypeId);

View Full Code Here

    String columnName;
    String defaultID;
    DefaultInfoImpl    defaultInfo = null;
    ColumnDescriptor colDesc;
    BaseTypeIdImpl    typeId;
    TypeId  wrapperTypeId;
    DataValueDescriptor  defaultValue = null;
    UUID        defaultUUID = null;
    UUID        uuid = null;
    UUIDFactory      uuidFactory = getUUIDFactory();
    long autoincStart, autoincInc;

    DataDescriptorGenerator  ddg = dd.getDataDescriptorGenerator();


    /*
    ** We're going to be getting the UUID for this sucka
    ** so make sure it is a UniqueTupleDescriptor.
    */
    if (parentTupleDescriptor != null)
    {
      if (SanityManager.DEBUG)
      {
        if (!(parentTupleDescriptor instanceof UniqueTupleDescriptor))
        {
          SanityManager.THROWASSERT(parentTupleDescriptor.getClass().getName()
              + " not instanceof UniqueTupleDescriptor")
        }
      }
      uuid = ((UniqueTupleDescriptor)parentTupleDescriptor).getUUID();
    }
    else
    {
      /* 1st column is REFERENCEID (char(36)) */
      uuid = uuidFactory.recreateUUID(row.getColumn(SYSCOLUMNS_REFERENCEID).
                          getString());
    }

    /* NOTE: We get columns 5 and 6 next in order to work around
     * a 1.3.0 HotSpot bug.  (#4361550)
     */

    // 5th column is COLUMNDEFAULT (serialiazable)
    Object object = row.getColumn(SYSCOLUMNS_COLUMNDEFAULT).getObject();
    if (object instanceof DataValueDescriptor)
    {
      defaultValue = (DataValueDescriptor) object;
    }
    else if (object instanceof DefaultInfoImpl)
    {
      defaultInfo = (DefaultInfoImpl) object;
      defaultValue = defaultInfo.getDefaultValue();
    }

    /* 6th column is DEFAULTID (char(36)) */
    defaultID = row.getColumn(SYSCOLUMNS_COLUMNDEFAULTID).getString();

    if (defaultID != null)
    {
      defaultUUID = uuidFactory.recreateUUID(defaultID);
    }

    /* 2nd column is COLUMNNAME (varchar(128)) */
    columnName = row.getColumn(SYSCOLUMNS_COLUMNNAME).getString();

    /* 3rd column is COLUMNNUMBER (int) */
    columnNumber = row.getColumn(SYSCOLUMNS_COLUMNNUMBER).getInt();

    /* 4th column is COLUMNDATATYPE */

    /*
    ** What is stored in the column is a TypeDescriptorImpl, which
    ** points to a BaseTypeIdImpl.  These are simple types that are
    ** intended to be movable to the client, so they don't have
    ** the entire implementation.  We need to wrap them in DataTypeServices
    ** and TypeId objects that contain the full implementations for
    ** language processing.
    */
    TypeDescriptorImpl typeDescriptor = (TypeDescriptorImpl) row.getColumn(SYSCOLUMNS_COLUMNDATATYPE).
                          getObject();
    typeId = typeDescriptor.getTypeId();

    /*
    ** The BaseTypeIdImpl tells what type of TypeId it is supposed to
    ** be wrapped in.
    */
    wrapperTypeId =
      (TypeId) Monitor.newInstanceFromIdentifier(typeId.wrapperTypeFormatId());
    /* Wrap the BaseTypeIdImpl in a full type id */
    wrapperTypeId.setNestedTypeId(typeId);

    /* Wrap the TypeDescriptorImpl in a full DataTypeDescriptor */
    DataTypeDescriptor dataTypeServices = new DataTypeDescriptor(typeDescriptor,
                          wrapperTypeId);

View Full Code Here

     */
    private void bindXMLParse() throws StandardException
    {
        // Check the type of the operand - this function is allowed only on
        // string value (char) types.
        TypeId operandType = operand.getTypeId();
        if (operandType != null) {
            switch (operandType.getJDBCTypeId())
            {
                case Types.CHAR:
                case Types.VARCHAR:
                case Types.LONGVARCHAR:
                case Types.CLOB:
                    break;
                default:
                {
                    throw StandardException.newException(
                        SQLState.LANG_UNARY_FUNCTION_BAD_TYPE,
                        methodName,
                        operandType.getSQLTypeName());
                }
            }
        }

        // Create a new XML compiler object; the constructor
View Full Code Here

     *
     * @exception StandardException Thrown on error
     */
    private void bindXMLSerialize() throws StandardException
    {
        TypeId operandType;

        // Check the type of the operand - this function is allowed only on
        // the XML type.
        operandType = operand.getTypeId();
        if ((operandType != null) && !operandType.isXMLTypeId())
        {
            throw StandardException.newException(
                SQLState.LANG_UNARY_FUNCTION_BAD_TYPE,
                methodName,
                operandType.getSQLTypeName());
        }

        // Check the target type.  We only allow string types to be used as
        // the target type.  The targetType is stored as the first Object
        // in our list of additional parameters, so we have to retrieve
        // it from there.
        if (SanityManager.DEBUG) {
            SanityManager.ASSERT(
                ((additionalArgs != null) && (additionalArgs.length > 0)),
                "Failed to locate target type for XMLSERIALIZE operator");
        }

        DataTypeDescriptor targetType =
            (DataTypeDescriptor)additionalArgs[0];

        TypeId targetTypeId = targetType.getTypeId();
        switch (targetTypeId.getJDBCTypeId())
        {
            case Types.CHAR:
            case Types.VARCHAR:
            case Types.LONGVARCHAR:
            case Types.CLOB:
                break;
            default:
            {
                throw StandardException.newException(
                    SQLState.LANG_INVALID_XMLSERIALIZE_TYPE,
                    targetTypeId.getSQLTypeName());
            }
        }

        // The result type of XMLSerialize() is always a string; which
        // kind of string is determined by the targetType field.
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.types.TypeId

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.