Package org.apache.derby.catalog.types

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


  {
    //Are we dealing with user defined function or procedure?
    if (aliasType == AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR ||
        aliasType == AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR) {

            RoutineAliasInfo    rai = (RoutineAliasInfo)aliasInfo;
           
            // Set the collation for all string types in parameters
            // and return types including row multi-sets to be that of
            // the schema the routine is being defined in.
            rai.setCollationTypeForAllStringTypes(
                    getSchemaDescriptor().getCollationType());

            bindParameterTypes( (RoutineAliasInfo)aliasInfo );

            if ( rai.hasVarargs() )
            {
                switch ( rai.getParameterStyle() )
                {
                case RoutineAliasInfo.PS_DERBY_JDBC_RESULT_SET:
                case RoutineAliasInfo.PS_DERBY:
                    break;

                default:
                    throw StandardException.newException( SQLState.LANG_VARARGS_PARAMETER_STYLE );
                }

                if ( rai.getMaxDynamicResultSets() > 0 )
                {
                    throw StandardException.newException( SQLState.LANG_VARARGS_RETURN_RESULT_SETS );
                }
            }

            if (
                (rai.getParameterStyle() == RoutineAliasInfo.PS_DERBY) &&
                !rai.hasVarargs()
                )
            {
                throw StandardException.newException( SQLState.LANG_DERBY_PARAMETER_STYLE );
            }
    }
View Full Code Here


        for ( int i = 0; i < systemFunctions.size(); i++ )
        {
            AliasDescriptor function = systemFunctions.get(i);

      RoutineAliasInfo routineInfo = (RoutineAliasInfo) function.getAliasInfo();
      int parameterCount = routineInfo.getParameterCount();
      if ( parameterCount == 1 )  { throw illegalAggregate(); }
        }
       
        //
        // Additional builtin 1-arg functions which are represented in the grammar
View Full Code Here

    for (int i = list.size() - 1; i >= 0; i--) {

            AliasDescriptor proc = list.get(i);

      RoutineAliasInfo rai = (RoutineAliasInfo) proc.getAliasInfo();
      int parameterCount = rai.getParameterCount();
            boolean hasVarargs = rai.hasVarargs();

            if ( hasVarargs )
            {
                // a varargs method can be called with no values supplied
                // for the trailing varargs argument
                if ( methodParms.length < (parameterCount - 1) ) { continue; }
            }
      else if (parameterCount != methodParms.length)
            { continue; }

      // pre-form the method signature. If it is a dynamic result set procedure
      // then we need to add in the ResultSet array

      TypeDescriptor[] parameterTypes = rai.getParameterTypes();

      int sigParameterCount = parameterCount;
      if (rai.getMaxDynamicResultSets() > 0)
            { sigParameterCount++; }

      signature = new JSQLType[sigParameterCount];
      for (int p = 0; p < parameterCount; p++) {

        // find the declared type.

        TypeDescriptor td = parameterTypes[p];

        TypeId typeId = TypeId.getTypeId(td);

        TypeId parameterTypeId = typeId;


        // if it's an OUT or INOUT parameter we need an array.
        int parameterMode = rai.getParameterModes()[ getRoutineArgIdx( rai, p ) ];

                if (parameterMode != (ParameterMetaData.parameterModeIn)) {

          String arrayType;
          switch (typeId.getJDBCTypeId()) {
View Full Code Here

     */
    public boolean isTableFunction()
    {
        if ( getAliasType() != AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR ) { return false; }

        RoutineAliasInfo    rai = (RoutineAliasInfo) getAliasInfo();

        return rai.getReturnType().isRowMultiSet();
    }
View Full Code Here

            for ( int i = 0; i < funcList.size(); i++ )
            {
                AliasDescriptor func = funcList.get(i);

        RoutineAliasInfo funcInfo = (RoutineAliasInfo) func.getAliasInfo();
                if ( funcInfo.getParameterCount() == 1 )
                {
                    throw StandardException.newException
                        ( SQLState.LANG_BAD_UDA_OR_FUNCTION_NAME, schemaName, aliasName );
                }
      }
View Full Code Here

       
        for (int i = list.size() - 1; i >= 0; i--)
        {
            AliasDescriptor proc = list.get(i);
           
            RoutineAliasInfo procedureInfo = (RoutineAliasInfo) proc.getAliasInfo();
            int parameterCount = procedureInfo.getParameterCount();
            if (parameterCount != ((RoutineAliasInfo) aliasInfo).getParameterCount())
            { continue; }
           
            // procedure duplicate checking is simple, only
            // one procedure with a given number of parameters.
View Full Code Here

                boolean found = false;
                for (int i = list.size() - 1; (!found) && i >= 0; i--)
                {
                    proc = list.get(i);

                    RoutineAliasInfo
                        routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
                    int parameterCount = routineInfo.getParameterCount();
                    if (parameterCount != routineDesignator.paramTypeList.size())
                        continue;
                    TypeDescriptor[] parameterTypes = routineInfo.getParameterTypes();
                    found = true;
                    for( int parmIdx = 0; parmIdx < parameterCount; parmIdx++)
                    {
                        if( ! parameterTypes[parmIdx].equals( routineDesignator.paramTypeList.get( parmIdx)))
                        {
View Full Code Here

   * should be called only after the procedure has been resolved.
   *
   * @return  SQL allowed by the procedure
   */
  private short getSQLAllowedInProcedure() {
    RoutineAliasInfo routineInfo = ((MethodCallNode)methodCall.getJavaValueNode()).routineInfo;
   
    // If this method is called before the routine has been resolved, routineInfo will be null
    if (SanityManager.DEBUG)
      SanityManager.ASSERT((routineInfo != null), "Failed to get routineInfo");

    return routineInfo.getSQLAllowed();
  }
View Full Code Here

         AliasDescriptor            ad,
         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

        default: return;
        }
       
    TransactionController tc = lcc.getTransactionExecute();
        RoutineAliasInfo      aliasInfo = (RoutineAliasInfo) ad.getAliasInfo();
        HashMap               addUdtMap = new HashMap();
        HashMap               dropUdtMap = new HashMap();
        HashMap               udtMap = adding ? addUdtMap : dropUdtMap;
        TypeDescriptor        rawReturnType = aliasInfo.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 = aliasInfo.getParameterTypes();
        if ( paramTypes != null )
        {
            int paramCount = paramTypes.length;
            for ( int i = 0; i < paramCount; i++ )
            {
View Full Code Here

TOP

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

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.