Package org.apache.derby.catalog.types

Examples of org.apache.derby.catalog.types.AggregateAliasInfo


                   )
                {
                    throw StandardException.newException( SQLState.LANG_XML_NOT_ALLOWED_DJRS );
                }

        aliasInfo = new AggregateAliasInfo( aggForType, aggReturnType );
        implicitCreateSchema = true;
                break;
               
      case AliasInfo.ALIAS_TYPE_UDT_AS_CHAR:
        this.javaClassName = (String) targetObject;
View Full Code Here


        {
            if ( NON_RESERVED_AGGREGATES[ i ].equals( unqualifiedName ) )  { throw illegalAggregate(); }
        }

        // now bind the input and return types
        AggregateAliasInfo  aai = (AggregateAliasInfo) aliasInfo;

        aai.setCollationTypeForAllStringTypes( getSchemaDescriptor().getCollationType() );
    }
View Full Code Here

            if ( genericParameterTypes == null ) {
                genericParameterTypes = new Class<?>[ AGGREGATOR_PARAM_COUNT ];
            }

            AggregateAliasInfo  aai = (AggregateAliasInfo) _alias.getAliasInfo();
            DataTypeDescriptor  expectedInputType = DataTypeDescriptor.getType( aai.getForType() );
            DataTypeDescriptor  expectedReturnType = DataTypeDescriptor.getType( aai.getReturnType() );
            Class<?>       expectedInputClass = getJavaClass( classFactory, expectedInputType );
            Class<?>       expectedReturnClass = getJavaClass( classFactory, expectedReturnType );

            // the input operand must be coercible to the expected input type of the aggregate
            if ( !tcf.getTypeCompiler( expectedInputType.getTypeId() ).storable( inputType.getTypeId(), classFactory ) )
View Full Code Here

   */
    final ValueNode castInputValue
        ( ValueNode inputValue, ContextManager cm )
        throws StandardException
  {
        AggregateAliasInfo  aai = (AggregateAliasInfo) _alias.getAliasInfo();
        DataTypeDescriptor  expectedInputType = DataTypeDescriptor.getType( aai.getForType() );
        DataTypeDescriptor  actualInputType = inputValue.getTypeServices();

        // no cast needed if the types match exactly
        if ( expectedInputType.isExactTypeAndLengthMatch( actualInputType ) ) { return null; }
        else
View Full Code Here

         boolean                    adding
         )
        throws StandardException
    {
        RoutineAliasInfo      routineInfo = null;
        AggregateAliasInfo  aggInfo = null;
       
        // nothing to do if this is not a routine
        switch ( ad.getAliasType() )
        {
    case AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR:
            aggInfo = (AggregateAliasInfo) ad.getAliasInfo();
            break;

    case AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR:
    case AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR:
            routineInfo = (RoutineAliasInfo) ad.getAliasInfo();
            break;

        default: return;
        }
       
    TransactionController tc = lcc.getTransactionExecute();

        HashMap<String,AliasDescriptor> addUdtMap =
                new HashMap<String,AliasDescriptor>();

        HashMap<String,AliasDescriptor> dropUdtMap =
                new HashMap<String,AliasDescriptor>();

        HashMap<String,AliasDescriptor> udtMap =
                adding ? addUdtMap : dropUdtMap;

        TypeDescriptor        rawReturnType = aggInfo != null ?
            aggInfo.getReturnType() : routineInfo.getReturnType();

        if ( rawReturnType != null )
        {
            AliasDescriptor       returnTypeAD = dd.getAliasDescriptorForUDT
                ( tc, DataTypeDescriptor.getType( rawReturnType ) );

            if ( returnTypeAD != null ) { udtMap.put( returnTypeAD.getObjectID().toString(), returnTypeAD ); }
        }

        // table functions can have udt columns. track those dependencies.
        if ( (rawReturnType != null) && rawReturnType.isRowMultiSet() )
        {
            TypeDescriptor[] columnTypes = rawReturnType.getRowTypes();
            int columnCount = columnTypes.length;

            for ( int i = 0; i < columnCount; i++ )
            {
                AliasDescriptor       columnTypeAD = dd.getAliasDescriptorForUDT
                    ( tc, DataTypeDescriptor.getType( columnTypes[ i ] ) );

                if ( columnTypeAD != null ) { udtMap.put( columnTypeAD.getObjectID().toString(), columnTypeAD ); }
            }
        }

        TypeDescriptor[]      paramTypes = aggInfo != null ?
            new TypeDescriptor[] { aggInfo.getForType() } : routineInfo.getParameterTypes();
        if ( paramTypes != null )
        {
            int paramCount = paramTypes.length;
            for ( int i = 0; i < paramCount; i++ )
            {
View Full Code Here

         boolean                    adding
         )
        throws StandardException
    {
        RoutineAliasInfo      routineInfo = null;
        AggregateAliasInfo  aggInfo = null;
       
        // nothing to do if this is not a routine
        switch ( ad.getAliasType() )
        {
    case AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR:
            aggInfo = (AggregateAliasInfo) ad.getAliasInfo();
            break;

    case AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR:
    case AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR:
            routineInfo = (RoutineAliasInfo) ad.getAliasInfo();
            break;

        default: return;
        }
       
    TransactionController tc = lcc.getTransactionExecute();
        HashMap               addUdtMap = new HashMap();
        HashMap               dropUdtMap = new HashMap();
        HashMap               udtMap = adding ? addUdtMap : dropUdtMap;
        TypeDescriptor        rawReturnType = aggInfo != null ?
            aggInfo.getReturnType() : routineInfo.getReturnType();

        if ( rawReturnType != null )
        {
            AliasDescriptor       returnTypeAD = dd.getAliasDescriptorForUDT
                ( tc, DataTypeDescriptor.getType( rawReturnType ) );

            if ( returnTypeAD != null ) { udtMap.put( returnTypeAD.getObjectID().toString(), returnTypeAD ); }
        }

        // table functions can have udt columns. track those dependencies.
        if ( (rawReturnType != null) && rawReturnType.isRowMultiSet() )
        {
            TypeDescriptor[] columnTypes = rawReturnType.getRowTypes();
            int columnCount = columnTypes.length;

            for ( int i = 0; i < columnCount; i++ )
            {
                AliasDescriptor       columnTypeAD = dd.getAliasDescriptorForUDT
                    ( tc, DataTypeDescriptor.getType( columnTypes[ i ] ) );

                if ( columnTypeAD != null ) { udtMap.put( columnTypeAD.getObjectID().toString(), columnTypeAD ); }
            }
        }

        TypeDescriptor[]      paramTypes = aggInfo != null ?
            new TypeDescriptor[] { aggInfo.getForType() } : routineInfo.getParameterTypes();
        if ( paramTypes != null )
        {
            int paramCount = paramTypes.length;
            for ( int i = 0; i < paramCount; i++ )
            {
View Full Code Here

                   )
                {
                    throw StandardException.newException( SQLState.LANG_XML_NOT_ALLOWED_DJRS );
                }

        aliasInfo = new AggregateAliasInfo( aggForType, aggReturnType );
        implicitCreateSchema = true;
                break;
               
      case AliasInfo.ALIAS_TYPE_UDT_AS_CHAR:
        this.javaClassName = (String) targetObject;
View Full Code Here

        {
            if ( NON_RESERVED_AGGREGATES[ i ].equals( unqualifiedName ) )  { throw illegalAggregate(); }
        }

        // now bind the input and return types
        AggregateAliasInfo  aai = (AggregateAliasInfo) aliasInfo;

        aai.setCollationTypeForAllStringTypes( getSchemaDescriptor().getCollationType() );
    }
View Full Code Here

            Class[]   genericParameterTypes = classFactory.getClassInspector().getGenericParameterTypes
                ( derbyAggregatorInterface, userAggregatorClass );
            if ( genericParameterTypes == null ) { genericParameterTypes = new Class[ AGGREGATOR_PARAM_COUNT ]; }

            AggregateAliasInfo  aai = (AggregateAliasInfo) _alias.getAliasInfo();
            DataTypeDescriptor  expectedInputType = DataTypeDescriptor.getType( aai.getForType() );
            DataTypeDescriptor  expectedReturnType = DataTypeDescriptor.getType( aai.getReturnType() );
            Class       expectedInputClass = getJavaClass( classFactory, expectedInputType );
            Class       expectedReturnClass = getJavaClass( classFactory, expectedReturnType );

            // the input operand must be coercible to the expected input type of the aggregate
            if ( !tcf.getTypeCompiler( expectedInputType.getTypeId() ).storable( inputType.getTypeId(), classFactory ) )
View Full Code Here

   */
  public final ValueNode  castInputValue
        ( ValueNode inputValue, NodeFactory nodeFactory, ContextManager cm )
        throws StandardException
  {
        AggregateAliasInfo  aai = (AggregateAliasInfo) _alias.getAliasInfo();
        DataTypeDescriptor  expectedInputType = DataTypeDescriptor.getType( aai.getForType() );
        DataTypeDescriptor  actualInputType = inputValue.getTypeServices();

        // no cast needed if the types match exactly
        if ( expectedInputType.isExactTypeAndLengthMatch( actualInputType ) ) { return null; }
        else
View Full Code Here

TOP

Related Classes of org.apache.derby.catalog.types.AggregateAliasInfo

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.