use of org.jooq.meta.hsqldb.information_schema.tables.DomainConstraints in project jOOQ by jOOQ.
the class H2Database method getDomains2_0.
private List<DomainDefinition> getDomains2_0() {
List<DomainDefinition> result = new ArrayList<>();
Domains d = Tables.DOMAINS.as("d");
DomainConstraints dc = DOMAIN_CONSTRAINTS.as("dc");
for (Record record : create().select(d.DOMAIN_SCHEMA, d.DOMAIN_NAME, d.DATA_TYPE, d.CHARACTER_MAXIMUM_LENGTH, coalesce(d.DATETIME_PRECISION, d.NUMERIC_PRECISION).as(d.NUMERIC_PRECISION), d.NUMERIC_SCALE, d.DOMAIN_DEFAULT, dc.checkConstraints().CHECK_CLAUSE).from(d).leftJoin(dc).on(d.DOMAIN_CATALOG.eq(dc.DOMAIN_CATALOG)).and(d.DOMAIN_SCHEMA.eq(dc.DOMAIN_SCHEMA)).and(d.DOMAIN_NAME.eq(dc.DOMAIN_NAME)).where(d.DOMAIN_SCHEMA.in(getInputSchemata())).and(d.DATA_TYPE.ne(inline("ENUM"))).orderBy(d.DOMAIN_SCHEMA, d.DOMAIN_NAME)) {
SchemaDefinition schema = getSchema(record.get(d.DOMAIN_SCHEMA));
DataTypeDefinition baseType = new DefaultDataTypeDefinition(this, schema, record.get(d.DATA_TYPE), record.get(d.CHARACTER_MAXIMUM_LENGTH), record.get(d.NUMERIC_PRECISION), record.get(d.NUMERIC_SCALE), true, record.get(d.DOMAIN_DEFAULT));
DefaultDomainDefinition domain = new DefaultDomainDefinition(schema, record.get(d.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;
}
use of org.jooq.meta.hsqldb.information_schema.tables.DomainConstraints 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;
}
Aggregations