addColumn(t, "CONSTRAINT_NAME", SQL_IDENTIFIER); // not null
addColumn(t, "SPECIFIC_CATALOG", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER); // not null
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[CHECK_CONSTRAINT_ROUTINE_USAGE].name, false,
SchemaObject.INDEX);
t.createPrimaryKeyConstraint(name, new int[] {
0, 1, 2, 3, 4, 5
}, false);
return t;
}
// column number mappings
final int constraint_catalog = 0;
final int constraint_schema = 1;
final int constraint_name = 2;
final int specific_catalog = 3;
final int specific_schema = 4;
final int specific_name = 5;
//
PersistentStore store = session.sessionData.getRowStore(t);
// Intermediate holders
Iterator constraints;
Constraint constraint;
OrderedHashSet references;
RoutineSchema routine;
Object[] row;
constraints = database.schemaManager.databaseObjectIterator(
SchemaObject.CONSTRAINT);
while (constraints.hasNext()) {
HsqlName constraintName = (HsqlName) constraints.next();
if (constraintName.parent == null) {
continue;
}
if (!session.getGrantee().isFullyAccessibleByRole(
constraintName.parent)) {
continue;
}
switch (constraintName.parent.type) {
case SchemaObject.TABLE : {
Table table;
try {
table = (Table) database.schemaManager.getSchemaObject(
constraintName.parent.name,
constraintName.parent.schema.name,
SchemaObject.TABLE);
} catch (Exception e) {
continue;
}
constraint = table.getConstraint(constraintName.name);
if (constraint.getConstraintType()
!= SchemaObject.ConstraintTypes.CHECK) {
continue;
}
break;
}
case SchemaObject.DOMAIN : {
Type domain;
try {
domain = (Type) database.schemaManager.getSchemaObject(
constraintName.parent.name,
constraintName.parent.schema.name,
SchemaObject.DOMAIN);
} catch (Exception e) {
continue;
}
constraint = domain.userTypeModifier.getConstraint(
constraintName.name);
}
default :
continue;
}
references = constraint.getReferences();
for (int i = 0; i < references.size(); i++) {
HsqlName name = (HsqlName) references.get(i);
if (name.type != SchemaObject.SPECIFIC_ROUTINE) {
continue;
}