String viewSchema;
String viewName;
// Intermediate holders
Iterator tables;
View view;
Table table;
Object[] row;
Iterator iterator;
// Column number mappings
final int view_catalog = 0;
final int view_schema = 1;
final int view_name = 2;
final int table_catalog = 3;
final int table_schema = 4;
final int table_name = 5;
final int column_name = 6;
// Initialization
tables =
database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);
// Do it.
while (tables.hasNext()) {
table = (Table) tables.next();
if (table.isView()
&& session.getGrantee().isFullyAccessibleByRole(table)) {
// fall through
} else {
continue;
}
viewCatalog = database.getCatalogName().name;
viewSchema = table.getSchemaName().name;
viewName = table.getName().name;
view = (View) table;
OrderedHashSet references = view.getReferences();
iterator = references.iterator();
while (iterator.hasNext()) {
HsqlName refName = (HsqlName) iterator.next();