Iterator tables;
Table table;
Constraint[] constraints;
int constraintCount;
Constraint constraint;
OrderedHashSet collector;
Iterator iterator;
OrderedHashSet methodSet;
Method method;
Object[] row;
tables =
database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);
collector = new OrderedHashSet();
while (tables.hasNext()) {
collector.clear();
table = (Table) tables.next();
if (table.isView()
|| !session.getGrantee().isFullyAccessibleByRole(table)) {
continue;
}
constraints = table.getConstraints();
constraintCount = constraints.length;
constraintCatalog = database.getCatalogName().name;
constraintSchema = table.getSchemaName().name;
specificSchema =
database.schemaManager.getDefaultSchemaHsqlName().name;
for (int i = 0; i < constraintCount; i++) {
constraint = constraints[i];
if (constraint.getConstraintType() != Constraint.CHECK) {
continue;
}
constraintName = constraint.getName().name;
constraint.getCheckExpression().collectAllFunctionExpressions(
collector);
methodSet = new OrderedHashSet();
iterator = collector.iterator();
while (iterator.hasNext()) {
/*
Function expression = (Function) iterator.next();
String className =
expression.getMethod().getDeclaringClass().getName();
String schema =
database.schemaManager.getDefaultSchemaHsqlName().name;
SchemaObject object =
database.schemaManager.getSchemaObject(className,
schema, SchemaObject.FUNCTION);
if (!session.getGrantee().isAccessible(object)) {
continue;
}
methodSet.add(expression.getMethod());
*/
}
iterator = methodSet.iterator();
while (iterator.hasNext()) {
method = (Method) iterator.next();
row = t.getEmptyRowData();
row[constraint_catalog] = constraintCatalog;