Search in sources :

Example 6 with DependencyDescriptor

use of org.apache.derby.iapi.sql.dictionary.DependencyDescriptor in project derby by apache.

the class BasicDependencyManager method dropDependency.

/**
 *		drops a single dependency
 *
 *		@param d the dependent
 *		@param p the provider
 *
 *		@exception StandardException thrown if something goes wrong
 */
private void dropDependency(LanguageConnectionContext lcc, Dependent d, Provider p) throws StandardException {
    if (SanityManager.DEBUG) {
        // right now, this routine isn't called for in-memory dependencies
        if (!d.isPersistent() || !p.isPersistent()) {
            SanityManager.NOTREACHED();
        }
    }
    DependencyDescriptor dependencyDescriptor = new DependencyDescriptor(d, p);
    dd.dropStoredDependency(dependencyDescriptor, lcc.getTransactionExecute());
}
Also used : DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor)

Example 7 with DependencyDescriptor

use of org.apache.derby.iapi.sql.dictionary.DependencyDescriptor in project derby by apache.

the class SYSDEPENDSRowFactory method makeRow.

// ///////////////////////////////////////////////////////////////////////////
// 
// METHODS
// 
// ///////////////////////////////////////////////////////////////////////////
/**
 * Make a SYSDEPENDS row
 *
 * @param td DependencyDescriptor. If its null then we want to make an empty
 * row.
 *
 * @return	Row suitable for inserting into SYSDEPENDS.
 *
 * @exception   StandardException thrown on failure
 */
public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent) throws StandardException {
    DataValueDescriptor col;
    ExecRow row;
    String dependentID = null;
    DependableFinder dependentBloodhound = null;
    String providerID = null;
    DependableFinder providerBloodhound = null;
    if (td != null) {
        DependencyDescriptor dd = (DependencyDescriptor) td;
        dependentID = dd.getUUID().toString();
        dependentBloodhound = dd.getDependentFinder();
        if (dependentBloodhound == null) {
            throw StandardException.newException(SQLState.DEP_UNABLE_TO_STORE);
        }
        providerID = dd.getProviderID().toString();
        providerBloodhound = dd.getProviderFinder();
        if (providerBloodhound == null) {
            throw StandardException.newException(SQLState.DEP_UNABLE_TO_STORE);
        }
    }
    /* Insert info into sysdepends */
    /* RESOLVE - It would be nice to require less knowledge about sysdepends
		 * and have this be more table driven.
		 */
    /* Build the row to insert  */
    row = getExecutionFactory().getValueRow(SYSDEPENDS_COLUMN_COUNT);
    /* 1st column is DEPENDENTID (UUID - char(36)) */
    row.setColumn(SYSDEPENDS_DEPENDENTID, new SQLChar(dependentID));
    /* 2nd column is DEPENDENTFINDER */
    row.setColumn(SYSDEPENDS_DEPENDENTTYPE, new UserType(dependentBloodhound));
    /* 3rd column is PROVIDERID (UUID - char(36)) */
    row.setColumn(SYSDEPENDS_PROVIDERID, new SQLChar(providerID));
    /* 4th column is PROVIDERFINDER */
    row.setColumn(SYSDEPENDS_PROVIDERTYPE, new UserType(providerBloodhound));
    return row;
}
Also used : DependableFinder(org.apache.derby.catalog.DependableFinder) DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UserType(org.apache.derby.iapi.types.UserType)

Example 8 with DependencyDescriptor

use of org.apache.derby.iapi.sql.dictionary.DependencyDescriptor in project derby by apache.

the class SYSDEPENDSRowFactory method buildDescriptor.

// /////////////////////////////////////////////////////////////////////////
// 
// ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
// 
// /////////////////////////////////////////////////////////////////////////
/**
 * Make a ConstraintDescriptor out of a SYSDEPENDS row
 *
 * @param row a SYSDEPENDSS row
 * @param parentTupleDescriptor	Null for this kind of descriptor.
 * @param dd dataDictionary
 *
 * @exception   StandardException thrown on failure
 */
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException {
    DependencyDescriptor dependencyDesc = null;
    if (SanityManager.DEBUG) {
        SanityManager.ASSERT(row.nColumns() == SYSDEPENDS_COLUMN_COUNT, "Wrong number of columns for a SYSDEPENDS row");
    }
    DataValueDescriptor col;
    String dependentIDstring;
    UUID dependentUUID;
    DependableFinder dependentBloodhound;
    String providerIDstring;
    UUID providerUUID;
    DependableFinder providerBloodhound;
    /* 1st column is DEPENDENTID (UUID - char(36)) */
    col = row.getColumn(SYSDEPENDS_DEPENDENTID);
    dependentIDstring = col.getString();
    dependentUUID = getUUIDFactory().recreateUUID(dependentIDstring);
    /* 2nd column is DEPENDENTTYPE */
    col = row.getColumn(SYSDEPENDS_DEPENDENTTYPE);
    dependentBloodhound = (DependableFinder) col.getObject();
    /* 3rd column is PROVIDERID (UUID - char(36)) */
    col = row.getColumn(SYSDEPENDS_PROVIDERID);
    providerIDstring = col.getString();
    providerUUID = getUUIDFactory().recreateUUID(providerIDstring);
    /* 4th column is PROVIDERTYPE */
    col = row.getColumn(SYSDEPENDS_PROVIDERTYPE);
    providerBloodhound = (DependableFinder) col.getObject();
    /* now build and return the descriptor */
    return new DependencyDescriptor(dependentUUID, dependentBloodhound, providerUUID, providerBloodhound);
}
Also used : DependableFinder(org.apache.derby.catalog.DependableFinder) DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) UUID(org.apache.derby.catalog.UUID)

Example 9 with DependencyDescriptor

use of org.apache.derby.iapi.sql.dictionary.DependencyDescriptor in project derby by apache.

the class DataDictionaryImpl method getProvidersDescriptorList.

/**
 * Gets a list of the dependency descriptors for the given provider's id.
 *
 * @param providerID		The ID of the provider we're interested in
 *
 * @return	List			Returns a list of DependencyDescriptors.
 *							Returns an empty List if no stored dependencies for the
 *							provider's ID.
 *
 * @exception StandardException		Thrown on failure
 */
public List<DependencyDescriptor> getProvidersDescriptorList(String providerID) throws StandardException {
    List<DependencyDescriptor> ddlList = newSList();
    DataValueDescriptor providerIDOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
    /* Use providerIDOrderable in both start and stop positions for scan */
    providerIDOrderable = new SQLChar(providerID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, providerIDOrderable);
    getDescriptorViaIndex(SYSDEPENDSRowFactory.SYSDEPENDS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, ddlList, DependencyDescriptor.class, false);
    return ddlList;
}
Also used : DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 10 with DependencyDescriptor

use of org.apache.derby.iapi.sql.dictionary.DependencyDescriptor in project derby by apache.

the class DataDictionaryImpl method getDependentsDescriptorList.

/**
 * Gets a list of the dependency descriptors for the given dependent's id.
 *
 * @param dependentID		The ID of the dependent we're interested in
 *
 * @return	List			Returns a list of DependencyDescriptors.
 *							Returns an empty List if no stored dependencies for the
 *							dependent's ID.
 *
 * @exception StandardException		Thrown on failure
 */
public List<DependencyDescriptor> getDependentsDescriptorList(String dependentID) throws StandardException {
    List<DependencyDescriptor> ddlList = newSList();
    DataValueDescriptor dependentIDOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
    /* Use dependentIDOrderable in both start and stop positions for scan */
    dependentIDOrderable = new SQLChar(dependentID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, dependentIDOrderable);
    getDescriptorViaIndex(SYSDEPENDSRowFactory.SYSDEPENDS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, ddlList, DependencyDescriptor.class, false);
    return ddlList;
}
Also used : DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Aggregations

DependencyDescriptor (org.apache.derby.iapi.sql.dictionary.DependencyDescriptor)10 DependableFinder (org.apache.derby.catalog.DependableFinder)4 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)4 TransactionController (org.apache.derby.iapi.store.access.TransactionController)3 SQLChar (org.apache.derby.iapi.types.SQLChar)3 ArrayList (java.util.ArrayList)2 UUID (org.apache.derby.catalog.UUID)2 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)2 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)2 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)2 ReferencedColumnsDescriptorImpl (org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl)1 ContextManager (org.apache.derby.iapi.services.context.ContextManager)1 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)1 Dependency (org.apache.derby.iapi.sql.depend.Dependency)1 DependencyManager (org.apache.derby.iapi.sql.depend.DependencyManager)1 Dependent (org.apache.derby.iapi.sql.depend.Dependent)1 Provider (org.apache.derby.iapi.sql.depend.Provider)1 AliasDescriptor (org.apache.derby.iapi.sql.dictionary.AliasDescriptor)1 CheckConstraintDescriptor (org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor)1 ColumnDescriptor (org.apache.derby.iapi.sql.dictionary.ColumnDescriptor)1