{
if (ei >= list.size())
continue;
Dependency dependency = (Dependency) list.get(ei);
Dependent dep = dependency.getDependent();
if (affectedCols != null)
{
TableDescriptor td = (TableDescriptor) dependency.getProvider();
FormatableBitSet providingCols = td.getReferencedColumnMap();
if (providingCols == null)
{
if (dep instanceof ViewDescriptor)
{
ViewDescriptor vd = (ViewDescriptor) dep;
DataDictionary dd = getDataDictionary();
SchemaDescriptor compSchema;
compSchema = dd.getSchemaDescriptor(vd.getCompSchemaId(), null);
CompilerContext newCC = lcc.pushCompilerContext(compSchema);
Parser pa = newCC.getParser();
LanguageConnectionFactory lcf = lcc.getLanguageConnectionFactory();
// Since this is always nested inside another SQL
// statement, so topLevel flag should be false
CreateViewNode cvn = (CreateViewNode)pa.parseStatement(
vd.getViewText());
// need a current dependent for bind
newCC.setCurrentDependent(dep);
cvn = (CreateViewNode) cvn.bind();
ProviderInfo[] providerInfos = cvn.getProviderInfo();
lcc.popCompilerContext(newCC);
boolean interferent = false;
for (int i = 0; i < providerInfos.length; i++)
{
Provider provider = null;
try
{
provider = (Provider) providerInfos[i].
getDependableFinder().
getDependable(
providerInfos[i].getObjectId());
}
catch(java.sql.SQLException te)
{
if (SanityManager.DEBUG)
{
SanityManager.THROWASSERT("unexpected java.sql.SQLException - " + te);
}
}
if (provider instanceof TableDescriptor)
{
TableDescriptor tab = (TableDescriptor)provider;
FormatableBitSet colMap = tab.getReferencedColumnMap();
if (colMap == null)
continue;
// if later on an error is raised such as in
// case of interference, this dependency line
// upgrade will not happen due to rollback
tab.setReferencedColumnMap(null);
dropDependency(lcc, vd, tab);
tab.setReferencedColumnMap(colMap);
addDependency(vd, tab, lcc.getContextManager());
if (tab.getObjectID().equals(td.getObjectID()))
{
System.arraycopy(affectedCols.getByteArray(), 0,
subsetCols.getByteArray(), 0,
affectedCols.getLengthInBytes());
subsetCols.and(colMap);
if (subsetCols.anySetBit() != -1)
{
interferent = true;
((TableDescriptor) p).setReferencedColumnMap(subsetCols);
}
}
} // if provider instanceof TableDescriptor
} // for providerInfos
if (! interferent)
continue;
} // if dep instanceof ViewDescriptor
else
((TableDescriptor) p).setReferencedColumnMap(null);
} // if providingCols == null
else
{
System.arraycopy(affectedCols.getByteArray(), 0, subsetCols.getByteArray(), 0, affectedCols.getLengthInBytes());
subsetCols.and(providingCols);
if (subsetCols.anySetBit() == -1)
continue;
((TableDescriptor) p).setReferencedColumnMap(subsetCols);
}
}
// generate a list of invalidations that fail.
try {
dep.prepareToInvalidate(p, action, lcc);
} catch (StandardException sqle) {
if (noInvalidate != null)
sqle.setNestedException(noInvalidate);
noInvalidate = sqle;
}
if (noInvalidate == null) {
if (affectedCols != null)
((TableDescriptor) p).setReferencedColumnMap(affectedCols);
// REVISIT: future impl will want to mark the individual
// dependency as invalid as well as the dependent...
dep.makeInvalid(action, lcc);
}
}
if (noInvalidate != null)
throw noInvalidate;