/* Resolve the view, if this is a view */
if (tableDescriptor.getTableType() == TableDescriptor.VIEW_TYPE)
{
FromTable fsq;
ResultSetNode rsn;
ViewDescriptor vd;
CreateViewNode cvn;
SchemaDescriptor compSchema;
SchemaDescriptor prevCompSchema;
/* Get the associated ViewDescriptor so that we can get
* the view definition text.
*/
vd = dataDictionary.getViewDescriptor(tableDescriptor);
/*
** Set the default compilation schema to be whatever
** this schema this view was originally compiled against.
** That way we pick up the same tables no matter what
** schema we are running against.
*/
compSchema = dataDictionary.getSchemaDescriptor(vd.getCompSchemaId(), null);
prevCompSchema = compilerContext.setCompilationSchema(compSchema);
try
{
/* This represents a view - query is dependent on the ViewDescriptor */
compilerContext.createDependency(vd);
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(vd != null,
"vd not expected to be null for " + tableName);
}
/*
** Push a compiler context to parse the query text so that
** it won't clobber the current context.
*/
LanguageConnectionContext lcc = getLanguageConnectionContext();
CompilerContext newCC = lcc.pushCompilerContext();
cvn = (CreateViewNode)
QueryTreeNode.parseQueryText(
newCC,
vd.getViewText(),
(DataValueDescriptor[])null, // default params
lcc);
lcc.popCompilerContext(newCC);