Search in sources :

Example 6 with DomainDefinition

use of org.jooq.meta.DomainDefinition in project jOOQ by jOOQ.

the class HSQLDBDatabase method getDomains0.

@Override
protected List<DomainDefinition> getDomains0() throws SQLException {
    List<DomainDefinition> result = new ArrayList<>();
    DomainConstraints dc = DOMAIN_CONSTRAINTS.as("dc");
    for (Record record : create().select(dc.domains().DOMAIN_SCHEMA, dc.domains().DOMAIN_NAME, dc.domains().DATA_TYPE, dc.domains().CHARACTER_MAXIMUM_LENGTH, dc.domains().NUMERIC_PRECISION, dc.domains().NUMERIC_SCALE, dc.domains().DOMAIN_DEFAULT, dc.checkConstraints().CHECK_CLAUSE).from(dc).where(dc.domains().DOMAIN_SCHEMA.in(getInputSchemata())).orderBy(dc.domains().DOMAIN_SCHEMA, dc.domains().DOMAIN_NAME)) {
        SchemaDefinition schema = getSchema(record.get(dc.domains().DOMAIN_SCHEMA));
        DataTypeDefinition baseType = new DefaultDataTypeDefinition(this, schema, record.get(dc.domains().DATA_TYPE), record.get(dc.domains().CHARACTER_MAXIMUM_LENGTH), record.get(dc.domains().NUMERIC_PRECISION), record.get(dc.domains().NUMERIC_SCALE), true, record.get(dc.domains().DOMAIN_DEFAULT));
        DefaultDomainDefinition domain = new DefaultDomainDefinition(schema, record.get(dc.domains().DOMAIN_NAME), baseType);
        if (!StringUtils.isBlank(record.get(dc.checkConstraints().CHECK_CLAUSE)))
            domain.addCheckClause(record.get(dc.checkConstraints().CHECK_CLAUSE));
        result.add(domain);
    }
    return result;
}
Also used : DefaultDomainDefinition(org.jooq.meta.DefaultDomainDefinition) SchemaDefinition(org.jooq.meta.SchemaDefinition) DefaultDomainDefinition(org.jooq.meta.DefaultDomainDefinition) DomainDefinition(org.jooq.meta.DomainDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) ArrayList(java.util.ArrayList) DomainConstraints(org.jooq.meta.hsqldb.information_schema.tables.DomainConstraints) Record(org.jooq.Record) DataTypeDefinition(org.jooq.meta.DataTypeDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition)

Aggregations

DomainDefinition (org.jooq.meta.DomainDefinition)6 ArrayList (java.util.ArrayList)5 Record (org.jooq.Record)5 DataTypeDefinition (org.jooq.meta.DataTypeDefinition)5 DefaultDataTypeDefinition (org.jooq.meta.DefaultDataTypeDefinition)5 DefaultDomainDefinition (org.jooq.meta.DefaultDomainDefinition)5 SchemaDefinition (org.jooq.meta.SchemaDefinition)5 DomainConstraints (org.jooq.meta.hsqldb.information_schema.tables.DomainConstraints)2 Domain (org.jooq.Domain)1 Schema (org.jooq.Schema)1 DSL (org.jooq.impl.DSL)1 Internal (org.jooq.impl.Internal)1 LazySchema (org.jooq.impl.LazySchema)1 LazySupplier (org.jooq.impl.LazySupplier)1 Rdb$fields (org.jooq.meta.firebird.rdb.tables.Rdb$fields)1 Domains (org.jooq.meta.hsqldb.information_schema.tables.Domains)1 PgConstraint (org.jooq.meta.postgres.pg_catalog.tables.PgConstraint)1 PgNamespace (org.jooq.meta.postgres.pg_catalog.tables.PgNamespace)1 PgType (org.jooq.meta.postgres.pg_catalog.tables.PgType)1