use of org.hsqldb_voltpatches.RoutineSchema in project voltdb by VoltDB.
the class DatabaseInformationFull method ROUTINE_COLUMN_USAGE.
Table ROUTINE_COLUMN_USAGE() {
Table t = sysTables[ROUTINE_COLUMN_USAGE];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ROUTINE_COLUMN_USAGE]);
addColumn(t, "SPECIFIC_CATALOG", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER);
addColumn(t, "ROUTINE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "ROUTINE_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "ROUTINE_NAME", SQL_IDENTIFIER);
addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER);
addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "TABLE_NAME", SQL_IDENTIFIER);
addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ROUTINE_COLUMN_USAGE].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 3, 4, 5, 0, 1, 2, 6, 7, 8, 9 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// column number mappings
final int specific_catalog = 0;
final int specific_schema = 1;
final int specific_name = 2;
final int routine_catalog = 3;
final int routine_schema = 4;
final int routine_name = 5;
final int table_catalog = 6;
final int table_schema = 7;
final int table_name = 8;
final int column_name = 9;
//
Iterator it;
Object[] row;
it = database.schemaManager.databaseObjectIterator(SchemaObject.ROUTINE);
while (it.hasNext()) {
RoutineSchema routine = (RoutineSchema) it.next();
if (!session.getGrantee().isAccessible(routine)) {
continue;
}
Routine[] specifics = routine.getSpecificRoutines();
for (int m = 0; m < specifics.length; m++) {
OrderedHashSet set = specifics[m].getReferences();
for (int i = 0; i < set.size(); i++) {
HsqlName refName = (HsqlName) set.get(i);
if (refName.type != SchemaObject.COLUMN) {
continue;
}
if (!session.getGrantee().isAccessible(refName)) {
continue;
}
row = t.getEmptyRowData();
//
row[specific_catalog] = database.getCatalogName().name;
row[specific_schema] = specifics[m].getSchemaName().name;
row[specific_name] = specifics[m].getName().name;
row[routine_catalog] = database.getCatalogName().name;
row[routine_schema] = routine.getSchemaName().name;
row[routine_name] = routine.getName().name;
row[table_catalog] = database.getCatalogName().name;
row[table_schema] = refName.parent.schema.name;
row[table_name] = refName.parent.name;
row[column_name] = refName.name;
try {
t.insertSys(store, row);
} catch (HsqlException e) {
}
}
}
}
return t;
}
use of org.hsqldb_voltpatches.RoutineSchema in project voltdb by VoltDB.
the class DatabaseInformationFull method ROUTINE_JAR_USAGE.
Table ROUTINE_JAR_USAGE() {
Table t = sysTables[ROUTINE_JAR_USAGE];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ROUTINE_JAR_USAGE]);
addColumn(t, "SPECIFIC_CATALOG", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER);
addColumn(t, "JAR_CATALOG", SQL_IDENTIFIER);
addColumn(t, "JAR_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "JAR_NAME", SQL_IDENTIFIER);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ROUTINE_JAR_USAGE].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0, 1, 2, 3, 4, 5 }, false);
return t;
}
// column number mappings
final int specific_catalog = 0;
final int specific_schema = 1;
final int specific_name = 2;
final int jar_catalog = 3;
final int jar_schema = 4;
final int jar_name = 5;
//
Iterator it;
Object[] row;
PersistentStore store = database.persistentStoreCollection.getStore(t);
it = database.schemaManager.databaseObjectIterator(SchemaObject.ROUTINE);
while (it.hasNext()) {
RoutineSchema routine = (RoutineSchema) it.next();
if (!session.getGrantee().isAccessible(routine)) {
continue;
}
Routine[] specifics = routine.getSpecificRoutines();
for (int m = 0; m < specifics.length; m++) {
if (specifics[m].getLanguage() != Routine.LANGUAGE_JAVA) {
continue;
}
row = t.getEmptyRowData();
row[specific_catalog] = database.getCatalogName().name;
row[specific_schema] = routine.getSchemaName().name;
row[specific_name] = routine.getName().name;
row[jar_catalog] = database.getCatalogName().name;
row[jar_schema] = database.schemaManager.getSQLJSchemaHsqlName();
row[jar_name] = "CLASSPATH";
t.insertSys(store, row);
}
}
return t;
}
Aggregations