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

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


      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.
 
View Full Code Here


    try
    {
      CompilerContext cc = (CompilerContext)
        ContextService.getContext(CompilerContext.CONTEXT_ID);
            ClassFactory    classFactory = cc.getClassFactory();
            TypeCompilerFactory tcf = cc.getTypeCompilerFactory();

            Class<?>   derbyAggregatorInterface = classFactory.loadApplicationClass( "org.apache.derby.agg.Aggregator" );
            Class<?>   userAggregatorClass = classFactory.loadApplicationClass( _alias.getJavaClassName() );

            Class[][]   typeBounds = classFactory.getClassInspector().getTypeBounds
                ( derbyAggregatorInterface, userAggregatorClass );

            if (
                (typeBounds == null) ||
                (typeBounds.length != AGGREGATOR_PARAM_COUNT) ||
                (typeBounds[ INPUT_TYPE ] == null) ||
                (typeBounds[ RETURN_TYPE ] == null)
                )
            {
                throw StandardException.newException
                    (
                     SQLState.LANG_ILLEGAL_UDA_CLASS,
                     _alias.getSchemaName(),
                     _alias.getName(),
                     userAggregatorClass.getName()
                     );
            }

            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 ) )
            { return null; }
           
            //
            // Make sure that the declared input type of the UDA actually falls within
            // the type bounds of the Aggregator implementation.
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.
 
View Full Code Here

    throws StandardException
  {
    int    count = signature.length;
    String  parmTypeNames[] = new String[ count ];

        TypeCompilerFactory tcf = (routineInfo == null ) ? null : getCompilerContext().getTypeCompilerFactory();

    for ( int i = 0; i < count; i++ ) { parmTypeNames[i] = getObjectTypeName( signature[ i ], tcf ); }

    return parmTypeNames;
  }
View Full Code Here

    throws StandardException
  {
    int    count = signature.length;
    String  parmTypeNames[] = new String[ count ];

        TypeCompilerFactory tcf = (routineInfo == null ) ? null : getCompilerContext().getTypeCompilerFactory();

    for ( int i = 0; i < count; i++ ) { parmTypeNames[i] = getObjectTypeName( signature[ i ], tcf ); }

    return parmTypeNames;
  }
View Full Code Here

    try
    {
      CompilerContext cc = (CompilerContext)
        ContextService.getContext(CompilerContext.CONTEXT_ID);
            ClassFactory    classFactory = cc.getClassFactory();
            TypeCompilerFactory tcf = cc.getTypeCompilerFactory();

            Class   derbyAggregatorInterface = classFactory.loadApplicationClass( "org.apache.derby.agg.Aggregator" );
            Class   userAggregatorClass = classFactory.loadApplicationClass( _alias.getJavaClassName() );

            Class[][]   typeBounds = classFactory.getClassInspector().getTypeBounds
                ( derbyAggregatorInterface, userAggregatorClass );

            if (
                (typeBounds == null) ||
                (typeBounds.length != AGGREGATOR_PARAM_COUNT) ||
                (typeBounds[ INPUT_TYPE ] == null) ||
                (typeBounds[ RETURN_TYPE ] == null)
                )
            {
                throw StandardException.newException
                    (
                     SQLState.LANG_ILLEGAL_UDA_CLASS,
                     _alias.getSchemaName(),
                     _alias.getName(),
                     userAggregatorClass.getName()
                     );
            }

            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 ) )
            { return null; }
           
            //
            // Make sure that the declared input type of the UDA actually falls within
            // the type bounds of the Aggregator implementation.
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.
 
View Full Code Here

      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.
 
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.compile.TypeCompilerFactory

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.