// flattened in a previous loop)
if (_tableData.containsKey(table.getName())) {
// Find all tables that represent inner tags
Relationship[] foreignKeyRelationships = table.getForeignKeyRelationships();
if (foreignKeyRelationships.length == 1 && table.getPrimaryKeyRelationships().length == 0) {
Relationship foreignKeyRelationship = foreignKeyRelationships[0];
// If there is exactly one inner tag then we can probably
// flatten the tables, but it's only relevant if the inner
// tag only carry a single data column
int nonDataColumns = 0;
Column[] columns = table.getColumns();
for (Column column : columns) {
String nativeType = column.getNativeType();
// Use the native column type constants to determine if
// the column is an artificial column
if (NATIVE_TYPE_FOREIGN_KEY.equals(nativeType) || NATIVE_TYPE_PRIMARY_KEY.equals(nativeType)) {
nonDataColumns++;
}
}
if (columns.length == nonDataColumns + 1) {
// If the foreign key is unique for all rows, we will
// flatten it (otherwise it means that multiple inner
// tags occur, which requires two tables to deal with
// multiplicity)
boolean uniqueForeignKeys = true;
Column[] foreignColumns = foreignKeyRelationship.getForeignColumns();
SelectItem countAllItem = SelectItem.getCountAllItem();
Query q = new Query().select(foreignColumns).select(countAllItem).from(table).groupBy(foreignColumns);
DataSet data = executeQuery(q);
Comparable<Object> comparable = NumberComparator.getComparable(1);