Package org.apache.derby.catalog.types

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


        while ( rs.next() )
        {
            String    aliasName = rs.getString( 2 );
            boolean isSystemAlias = rs.getBoolean( 4 );

            RoutineAliasInfo    rai = (RoutineAliasInfo) rs.getObject( 5 );

            if ( isSystemAlias ) { assertFalse( aliasName, rai.isDeterministic() ); }
        }

        rs.close();
        ps.close();
    }
View Full Code Here


        while ( rs.next() )
        {
            String    aliasName = rs.getString( 2 );
            boolean isSystemAlias = rs.getBoolean( 4 );

            RoutineAliasInfo    rai = (RoutineAliasInfo) rs.getObject( 5 );

            if ( isSystemAlias ) { assertFalse( aliasName, rai.isDeterministic() ); }
        }

        rs.close();
        ps.close();
    }
View Full Code Here

             );
        ps.setString( 1, routineName );
        ResultSet               rs = ps.executeQuery();

        rs.next();
        RoutineAliasInfo    rai = (RoutineAliasInfo) rs.getObject( 1 );

        assertEquals( isDeterministic, rai.isDeterministic() );

        rs.close();
        ps.close();
    }
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

     */
    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

                   aggregateVector);

    // Is the parameter list to the constructor valid for a VTI?
    methodParms = methodCall.getMethodParms();

        RoutineAliasInfo    routineInfo = methodCall.getRoutineInfo();

        if (
            (routineInfo !=null) &&
            routineInfo.getReturnType().isRowMultiSet() &&
            (routineInfo.getParameterStyle() == RoutineAliasInfo.PS_DERBY_JDBC_RESULT_SET)
            )      {
            isDerbyStyleTableFunction = true;
        }

        if ( isDerbyStyleTableFunction )
        {
            Method boundMethod = (Method) methodCall.getResolvedMethod();

            isRestrictedTableFunction = RestrictedVTI.class.isAssignableFrom( boundMethod.getReturnType() );
        }

    /* If we have a valid constructor, does class implement the correct interface?
     * If version2 is true, then it must implement PreparedStatement, otherwise
     * it can implement either PreparedStatement or ResultSet.  (We check for
     * PreparedStatement first.)
     */

    if ( isConstructor() )
    {
        NewInvocationNode   constructor = (NewInvocationNode) methodCall;
               
        if (!constructor.assignableTo("java.sql.PreparedStatement"))
        {
      if (version2)
      {
        throw StandardException.newException(SQLState.LANG_DOES_NOT_IMPLEMENT,
                    getVTIName(),
                    "java.sql.PreparedStatement");
      }
      else if (! constructor.assignableTo("java.sql.ResultSet"))
      {
        throw StandardException.newException(SQLState.LANG_DOES_NOT_IMPLEMENT,
                    getVTIName(),
                    "java.sql.ResultSet");
      }
        }
        else
        {
          version2 = true;
        }
       
        /* If this is a version 2 VTI */
        if (version2)
        {
      // Does it support predicates
      implementsPushable = constructor.assignableTo("org.apache.derby.vti.IQualifyable");
        }
        // Remember whether or not the VTI implements the VTICosting interface
        implementsVTICosting = constructor.assignableTo(ClassName.VTICosting);
    }

        if ( isDerbyStyleTableFunction )
        {
            implementsVTICosting = implementsDerbyStyleVTICosting( methodCall.getJavaClassName() );
        }
           

    /* Build the RCL for this VTI.  We instantiate an object in order
     * to get the ResultSetMetaData.
     *
     * If we have a special trigger vti, then we branch off and get
     * its rcl from the trigger table that is waiting for us in
     * the compiler context.
     */
    UUID triggerTableId;
    if ((isConstructor()) && ((triggerTableId = getSpecialTriggerVTITableName(lcc, methodCall.getJavaClassName())) != null)  )
    {
      TableDescriptor td = getDataDictionary().getTableDescriptor(triggerTableId);
      resultColumns = genResultColList(td);

      // costing info
      vtiCosted = true;
      estimatedCost = 50d;
      estimatedRowCount = 5d;
      supportsMultipleInstantiations = true;
    }
    else
   
      resultColumns = (ResultColumnList) getNodeFactory().getNode(
                        C_NodeTypes.RESULT_COLUMN_LIST,
                        getContextManager());

      // if this is a Derby-style Table Function, then build the result
      // column list from the RowMultiSetImpl return datatype

      if ( isDerbyStyleTableFunction ) {
          createResultColumnsForTableFunction( routineInfo.getReturnType() );
      }
      else
      {
           
          ResultSetMetaData rsmd = getResultSetMetaData();
View Full Code Here

            {
                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, objectName.getFullTableName());
            }
       
            AliasDescriptor proc = null;
            RoutineAliasInfo routineInfo = null;
            java.util.List list = getDataDictionary().getRoutineList(
                sd.getUUID().toString(), objectName.getTableName(),
                routineDesignator.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR
                );

            if( routineDesignator.paramTypeList == null)
            {
                // No signature was specified. Make sure that there is exactly one routine with that name.
                if( list.size() > 1)
                {
                    throw StandardException.newException( ( routineDesignator.isFunction ? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME
                                                            : SQLState.LANG_AMBIGUOUS_PROCEDURE_NAME),
                                                          objectName.getFullTableName());
                }
                if( list.size() != 1) {
                    if (routineDesignator.isFunction) {
                        throw StandardException.newException(SQLState.LANG_NO_SUCH_FUNCTION,
                                objectName.getFullTableName());
                    } else {
                        throw StandardException.newException(SQLState.LANG_NO_SUCH_PROCEDURE,
                                objectName.getFullTableName());
                    }
                }
                proc = (AliasDescriptor) list.get(0);
            }
            else
            {
                // The full signature was specified
                boolean found = false;
                for (int i = list.size() - 1; (!found) && i >= 0; i--)
                {
                    proc = (AliasDescriptor) list.get(i);

                    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

        while ( rs.next() )
        {
            String    aliasName = rs.getString( 2 );
            boolean isSystemAlias = rs.getBoolean( 4 );

            RoutineAliasInfo    rai = (RoutineAliasInfo) rs.getObject( 5 );

            if ( isSystemAlias ) { assertFalse( aliasName, rai.isDeterministic() ); }
        }

        rs.close();
        ps.close();
    }
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               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

                   
                    dtd = bindUserType( dtd );
                    returnType = dtd.getCatalogType();
                }

                aliasInfo = new RoutineAliasInfo(
                    this.methodName,
                    paramCount,
                    names,
                    types,
                    modes,
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.