Search in sources :

Example 46 with SchemaDefinition

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

the class SQLiteDatabase method getSchemata0.

@Override
protected List<SchemaDefinition> getSchemata0() throws SQLException {
    List<SchemaDefinition> result = new ArrayList<SchemaDefinition>();
    result.add(new SchemaDefinition(this, "", ""));
    return result;
}
Also used : SchemaDefinition(org.jooq.util.SchemaDefinition) ArrayList(java.util.ArrayList)

Example 47 with SchemaDefinition

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

the class XMLDatabase method getPackages0.

@Override
protected List<PackageDefinition> getPackages0() {
    List<PackageDefinition> result = new ArrayList<PackageDefinition>();
    Set<String> packages = new HashSet<String>();
    for (Routine routine : info().getRoutines()) {
        String schemaName = defaultIfBlank(routine.getSpecificSchema(), routine.getRoutineSchema());
        if (getInputSchemata().contains(schemaName)) {
            SchemaDefinition schema = getSchema(schemaName);
            String packageName = defaultIfBlank(routine.getSpecificPackage(), routine.getRoutinePackage());
            if (!isBlank(packageName) && packages.add(packageName)) {
                result.add(new XMLPackageDefinition(schema, info(), packageName));
            }
        }
    }
    return result;
}
Also used : SchemaDefinition(org.jooq.util.SchemaDefinition) PackageDefinition(org.jooq.util.PackageDefinition) ArrayList(java.util.ArrayList) Routine(org.jooq.util.xml.jaxb.Routine) HashSet(java.util.HashSet)

Example 48 with SchemaDefinition

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

the class XMLDatabase method getRoutines0.

@Override
protected List<RoutineDefinition> getRoutines0() {
    List<RoutineDefinition> result = new ArrayList<RoutineDefinition>();
    for (Routine routine : info().getRoutines()) {
        if (isBlank(routine.getSpecificPackage()) && isBlank(routine.getRoutinePackage())) {
            String schemaName = defaultIfBlank(routine.getSpecificSchema(), routine.getRoutineSchema());
            if (getInputSchemata().contains(schemaName)) {
                SchemaDefinition schema = getSchema(schemaName);
                result.add(new XMLRoutineDefinition(schema, null, info(), routine));
            }
        }
    }
    return result;
}
Also used : RoutineDefinition(org.jooq.util.RoutineDefinition) SchemaDefinition(org.jooq.util.SchemaDefinition) ArrayList(java.util.ArrayList) Routine(org.jooq.util.xml.jaxb.Routine)

Example 49 with SchemaDefinition

use of org.jooq.util.SchemaDefinition 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 50 with SchemaDefinition

use of org.jooq.util.SchemaDefinition 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

SchemaDefinition (org.jooq.util.SchemaDefinition)51 Record (org.jooq.Record)36 ArrayList (java.util.ArrayList)29 TableDefinition (org.jooq.util.TableDefinition)28 DefaultDataTypeDefinition (org.jooq.util.DefaultDataTypeDefinition)14 DataTypeDefinition (org.jooq.util.DataTypeDefinition)13 ColumnDefinition (org.jooq.util.ColumnDefinition)12 DefaultSequenceDefinition (org.jooq.util.DefaultSequenceDefinition)7 SequenceDefinition (org.jooq.util.SequenceDefinition)7 DefaultColumnDefinition (org.jooq.util.DefaultColumnDefinition)4 PgNamespace (org.jooq.util.postgres.pg_catalog.tables.PgNamespace)4 StringUtils.defaultString (org.jooq.tools.StringUtils.defaultString)3 RoutineDefinition (org.jooq.util.RoutineDefinition)3 KeyColumnUsage (org.jooq.util.xml.jaxb.KeyColumnUsage)3 Record6 (org.jooq.Record6)2 Schema (org.jooq.Schema)2 DefaultCheckConstraintDefinition (org.jooq.util.DefaultCheckConstraintDefinition)2 DefaultEnumDefinition (org.jooq.util.DefaultEnumDefinition)2 EnumDefinition (org.jooq.util.EnumDefinition)2 Columns (org.jooq.util.postgres.information_schema.tables.Columns)2