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());
}
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;
}
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);
}
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;
}
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;
}
Aggregations