Search in sources :

Example 36 with TableDefinition

use of org.jooq.util.TableDefinition in project jOOQ by jOOQ.

the class XMLDatabase method getTables0.

@Override
protected List<TableDefinition> getTables0() {
    List<TableDefinition> result = new ArrayList<TableDefinition>();
    for (Table table : info().getTables()) {
        if (getInputSchemata().contains(table.getTableSchema())) {
            SchemaDefinition schema = getSchema(table.getTableSchema());
            result.add(new XMLTableDefinition(schema, info(), table));
        }
    }
    return result;
}
Also used : SchemaDefinition(org.jooq.util.SchemaDefinition) Table(org.jooq.util.xml.jaxb.Table) ArrayList(java.util.ArrayList) TableDefinition(org.jooq.util.TableDefinition)

Example 37 with TableDefinition

use of org.jooq.util.TableDefinition in project jOOQ by jOOQ.

the class XMLDatabase method loadUniqueKeys.

@Override
protected void loadUniqueKeys(DefaultRelations relations) {
    for (KeyColumnUsage usage : keyColumnUsage(UNIQUE)) {
        SchemaDefinition schema = getSchema(usage.getConstraintSchema());
        String key = usage.getConstraintName();
        String tableName = usage.getTableName();
        String columnName = usage.getColumnName();
        TableDefinition table = getTable(schema, tableName);
        if (table != null) {
            relations.addPrimaryKey(key, table.getColumn(columnName));
        }
    }
}
Also used : KeyColumnUsage(org.jooq.util.xml.jaxb.KeyColumnUsage) SchemaDefinition(org.jooq.util.SchemaDefinition) TableDefinition(org.jooq.util.TableDefinition)

Aggregations

TableDefinition (org.jooq.util.TableDefinition)37 Record (org.jooq.Record)32 SchemaDefinition (org.jooq.util.SchemaDefinition)28 ColumnDefinition (org.jooq.util.ColumnDefinition)14 ArrayList (java.util.ArrayList)9 KeyColumnUsage (org.jooq.util.xml.jaxb.KeyColumnUsage)3 HashMap (java.util.HashMap)2 DefaultCheckConstraintDefinition (org.jooq.util.DefaultCheckConstraintDefinition)2 DefaultEnumDefinition (org.jooq.util.DefaultEnumDefinition)2 EnumDefinition (org.jooq.util.EnumDefinition)2 StringReader (java.io.StringReader)1 Name (org.jooq.Name)1 Record5 (org.jooq.Record5)1 Record6 (org.jooq.Record6)1 Schema (org.jooq.Schema)1 CSVReader (org.jooq.tools.csv.CSVReader)1 Rdb$indexSegments (org.jooq.util.firebird.rdb.tables.Rdb$indexSegments)1 Rdb$refConstraints (org.jooq.util.firebird.rdb.tables.Rdb$refConstraints)1 Rdb$relationConstraints (org.jooq.util.firebird.rdb.tables.Rdb$relationConstraints)1 CheckConstraints (org.jooq.util.hsqldb.information_schema.tables.CheckConstraints)1