Package org.apache.derby.iapi.sql.dictionary

Examples of org.apache.derby.iapi.sql.dictionary.AliasDescriptor


        for ( int i = 0; i < changedColumnCount; i++ )
        {
            ColumnInfo ci = columnInfos[ i ];

            // skip this column if it is not a UDT
            AliasDescriptor ad = dd.getAliasDescriptorForUDT( tc, columnInfos[ i ].dataType );
            if ( ad == null ) { continue; }

            String key = ad.getObjectID().toString();

            if ( ci.action == ColumnInfo.CREATE )
            {
                addColumnNames.add( ci.name);

                // no need to add the descriptor if it is already on the list
                if ( addUdtMap.get( key ) != null ) { continue; }

                addUdtMap.put( key, ad );
            }
            else if ( ci.action == ColumnInfo.DROP )
            {
                dropColumnNames.add( ci.name );
                dropUdtMap.put( key, ad );
            }
        }

        // nothing to do if there are no changed columns of udt type
        // and this is not a DROP TABLE command
        if ( (!dropWholeTable) && (addUdtMap.size() == 0) && (dropUdtMap.size() == 0) ) { return; }

        //
        // Now prune from the add list all udt descriptors for which we already have dependencies.
        // These are the udts for old columns. This supports the ALTER TABLE ADD COLUMN
        // case.
        //
        // Also prune from the drop list add udt descriptors which will still be
        // referenced by the remaining columns.
        //
        ColumnDescriptorList cdl = td.getColumnDescriptorList();
        int totalColumnCount = cdl.size();

        for ( int i = 0; i < totalColumnCount; i++ )
        {
            ColumnDescriptor cd = cdl.elementAt( i );

            // skip columns that are being added and dropped. we only want the untouched columns
            if (
                addColumnNames.contains( cd.getColumnName() ) ||
                dropColumnNames.contains( cd.getColumnName() )
                ) { continue; }

            // nothing to do if the old column isn't a UDT
            AliasDescriptor ad = dd.getAliasDescriptorForUDT( tc, cd.getType() );
            if ( ad == null ) { continue; }

            String key = ad.getObjectID().toString();

            // ha, it is a UDT.
            if ( dropWholeTable ) { dropUdtMap.put( key, ad ); }
            else
            {
View Full Code Here


        // add new dependencies
        Iterator            addIterator = addUdtMap.values().iterator();
        while( addIterator.hasNext() )
        {
            AliasDescriptor ad = (AliasDescriptor) addIterator.next();

            dm.addDependency( dependent, ad, cm );
        }

        // drop dependencies that are orphaned
        Iterator            dropIterator = dropUdtMap.values().iterator();
        while( dropIterator.hasNext() )
        {
            AliasDescriptor ad = (AliasDescriptor) dropIterator.next();

            DependencyDescriptor dependency = new DependencyDescriptor( dependent, ad );

            dd.dropStoredDependency( dependency, tc );
        }
View Full Code Here

        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++ )
            {
                AliasDescriptor       paramType = dd.getAliasDescriptorForUDT
                    ( tc, DataTypeDescriptor.getType( paramTypes[ i ] ) );

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

        adjustUDTDependencies( lcc, dd, ad, addUdtMap, dropUdtMap );
    }
View Full Code Here

      forCallStatement ? AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR
      );

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

      AliasDescriptor proc = (AliasDescriptor) list.get(i);

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

            if ( hasVarargs )
            {
View Full Code Here

    {
      SchemaDescriptor nextSD = getSchemaDescriptor(nextSynonymSchema, false);
      if (nextSD == null || nextSD.getUUID() == null)
        break;
 
      AliasDescriptor nextAD = dd.getAliasDescriptor(nextSD.getUUID().toString(),
             nextSynonymTable, AliasInfo.ALIAS_NAME_SPACE_SYNONYM_AS_CHAR);
      if (nextAD == null)
        break;

      /* Query is dependent on the AliasDescriptor */
      cc.createDependency(nextAD);

      found = true;
      SynonymAliasInfo info = ((SynonymAliasInfo)nextAD.getAliasInfo());
      nextSynonymTable = info.getSynonymTable();
      nextSynonymSchema = info.getSynonymSchema();
    }

    if (!found)
View Full Code Here

        DataDictionary dd = getDataDictionary();
        SchemaDescriptor typeSchema = getSchemaDescriptor( userTypeID.getSchemaName() );
        char  udtNameSpace = AliasInfo.ALIAS_NAME_SPACE_UDT_AS_CHAR;
        String unqualifiedTypeName = userTypeID.getUnqualifiedName();
        AliasDescriptor ad = dd.getAliasDescriptor( typeSchema.getUUID().toString(), unqualifiedTypeName, udtNameSpace );

    if (ad == null)
    {
      throw StandardException.newException(SQLState.LANG_OBJECT_NOT_FOUND, AliasDescriptor.getAliasType(udtNameSpace),  unqualifiedTypeName);
    }

        createTypeDependency( ad );

        DataTypeDescriptor result = new DataTypeDescriptor
            (
             TypeId.getUserDefinedTypeId( typeSchema.getSchemaName(), unqualifiedTypeName, ad.getJavaClassName() ),
             originalDTD.isNullable()
             );

        return result;
    }
View Full Code Here

     *
     * @param dtd Type which may have a dependency declared on it.
     */
    public void createTypeDependency( DataTypeDescriptor dtd ) throws StandardException
    {
        AliasDescriptor ad = getDataDictionary().getAliasDescriptorForUDT( null, dtd );

        if ( ad != null ) { createTypeDependency( ad ); }
    }
View Full Code Here

       
    keyRow.setColumn(1, new SQLChar( SchemaDescriptor.SYSIBM_SCHEMA_UUID ));
    keyRow.setColumn(2, aliasNameOrderable);
    keyRow.setColumn(3, nameSpaceOrderable);

        AliasDescriptor      oldAD = (AliasDescriptor) getDescriptorViaIndex
            (
             SYSALIASESRowFactory.SYSALIASES_INDEX1_ID,
             keyRow,
             (ScanQualifier [][]) null,
             ti,
             (TupleDescriptor) null,
             (List) null,
             true,
             TransactionController.ISOLATION_REPEATABLE_READ,
             tc);
        RoutineAliasInfo   oldRai = (RoutineAliasInfo) oldAD.getAliasInfo();
        TypeDescriptor     newReturnType = DataTypeDescriptor.getCatalogType( Types.VARCHAR, Limits.MAX_CLOB_RETURN_LEN );
        RoutineAliasInfo   newRai = new RoutineAliasInfo
            (
             oldRai.getMethodName(),
             oldRai.getParameterCount(),
             oldRai.getParameterNames(),
             oldRai.getParameterTypes(),
             oldRai.getParameterModes(),
             oldRai.getMaxDynamicResultSets(),
             oldRai.getParameterStyle(),
             oldRai.getSQLAllowed(),
             oldRai.isDeterministic(),
             oldRai.hasVarargs(),
             oldRai.hasDefinersRights(),
             oldRai.calledOnNullInput(),
             newReturnType
             );
        AliasDescriptor      newAD = new AliasDescriptor
            (
             this,
             oldAD.getUUID(),
             oldAD.getObjectName(),
             oldAD.getSchemaUUID(),
View Full Code Here

       
    aliasKeyRow.setColumn(1, new SQLChar( SchemaDescriptor.SYSCS_UTIL_SCHEMA_UUID ));
    aliasKeyRow.setColumn(2, aliasNameOrderable);
    aliasKeyRow.setColumn(3, nameSpaceOrderable);

        AliasDescriptor      oldAD = (AliasDescriptor) getDescriptorViaIndex
            (
             SYSALIASESRowFactory.SYSALIASES_INDEX1_ID,
             aliasKeyRow,
             (ScanQualifier [][]) null,
             aliasTI,
             (TupleDescriptor) null,
             (List) null,
             true,
             TransactionController.ISOLATION_REPEATABLE_READ,
             tc);
        UUID                 aliasID = oldAD.getUUID();

        //
        // Now delete the permissions tuple which has a null grantor
        //
    TabInfoImpl          rpTI = getNonCoreTI(SYSROUTINEPERMS_CATALOG_NUM);
View Full Code Here

        BaseTypeIdImpl btii = dtd.getTypeId().getBaseTypeId();
        if ( !btii.isAnsiUDT() ) { return null; }

        SchemaDescriptor sd = getSchemaDescriptor( btii.getSchemaName(), tc, true );
        AliasDescriptor ad = getAliasDescriptor
            ( sd.getUUID().toString(), btii.getUnqualifiedName(), AliasInfo.ALIAS_NAME_SPACE_UDT_AS_CHAR );

        return ad;
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.AliasDescriptor

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.