use of org.jooq.meta.DefaultSequenceDefinition in project jOOQ by jOOQ.
the class H2Database method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<>();
for (Record record : sequences(getInputSchemata())) {
SchemaDefinition schema = getSchema(record.get(SEQUENCES.SEQUENCE_SCHEMA));
if (schema != null) {
String name = record.get(SEQUENCES.SEQUENCE_NAME);
DefaultDataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, H2DataType.BIGINT.getTypeName());
result.add(new DefaultSequenceDefinition(schema, name, type, null, // H2 doesn't support Postgres-style START WITH
null, record.get(SEQUENCES.INCREMENT), record.get(SEQUENCES.MIN_VALUE), record.get(SEQUENCES.MAX_VALUE), record.get(SEQUENCES.IS_CYCLE), record.get(SEQUENCES.CACHE)));
}
}
return result;
}
use of org.jooq.meta.DefaultSequenceDefinition in project jOOQ by jOOQ.
the class HSQLDBDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<>();
for (Record record : sequences(getInputSchemata())) {
SchemaDefinition schema = getSchema(record.get(SEQUENCES.SEQUENCE_SCHEMA));
DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, record.get(SEQUENCES.DATA_TYPE));
result.add(new DefaultSequenceDefinition(schema, record.get(SEQUENCES.SEQUENCE_NAME), type));
}
return result;
}
use of org.jooq.meta.DefaultSequenceDefinition in project jOOQ by jOOQ.
the class PostgresDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<>();
for (Record record : sequences(getInputSchemata())) {
SchemaDefinition schema = getSchema(record.get(SEQUENCES.SEQUENCE_SCHEMA));
DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, record.get(SEQUENCES.DATA_TYPE), 0, record.get(SEQUENCES.NUMERIC_PRECISION), record.get(SEQUENCES.NUMERIC_SCALE), false, (String) null);
result.add(new DefaultSequenceDefinition(schema, record.get(SEQUENCES.SEQUENCE_NAME), type, null, record.get(SEQUENCES.START_VALUE, BigInteger.class), record.get(SEQUENCES.INCREMENT, BigInteger.class), record.get(SEQUENCES.MINIMUM_VALUE, BigInteger.class), record.get(SEQUENCES.MAXIMUM_VALUE, BigInteger.class), record.get(SEQUENCES.CYCLE_OPTION, Boolean.class), // [#9442] The CACHE flag is not available from SEQUENCES
null));
}
return result;
}
use of org.jooq.meta.DefaultSequenceDefinition in project jOOQ by jOOQ.
the class DerbyDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<>();
for (Record record : sequences(getInputSchemata())) {
SchemaDefinition schema = getSchema(record.get(SYSSEQUENCES.sysschemas().SCHEMANAME));
DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, record.get(SYSSEQUENCES.SEQUENCEDATATYPE));
result.add(new DefaultSequenceDefinition(schema, record.get(SYSSEQUENCES.SEQUENCENAME), type, null, record.get(SYSSEQUENCES.STARTVALUE), record.get(SYSSEQUENCES.INCREMENT), record.get(SYSSEQUENCES.MINIMUMVALUE), record.get(SYSSEQUENCES.MAXIMUMVALUE), record.get(SYSSEQUENCES.CYCLEOPTION, Boolean.class), null));
}
return result;
}
use of org.jooq.meta.DefaultSequenceDefinition in project jOOQ by jOOQ.
the class MariaDBDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<>();
for (Record record : create().select(TABLES.TABLE_SCHEMA, TABLES.TABLE_NAME).from(TABLES).where(TABLES.TABLE_TYPE.eq("SEQUENCE"))) {
SchemaDefinition schema = getSchema(record.get(TABLES.TABLE_SCHEMA));
if (schema != null) {
String name = record.get(TABLES.TABLE_NAME);
DefaultDataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, BIGINT.getTypeName());
Field<Long> startWith = nullif(field("start_value", BIGINT), inline(1L));
Field<Long> incrementBy = nullif(field("increment", BIGINT), inline(1L));
Field<Long> minValue = inline(field("minimum_value", BIGINT), inline(1L));
Field<Long> maxValue = nullif(field("maximum_value", BIGINT), inline(DEFAULT_SEQUENCE_MAXVALUE));
Field<Boolean> cycle = field("cycle_option", BOOLEAN);
Field<Long> cache = nullif(field("cache_size", BIGINT), inline(DEFAULT_SEQUENCE_CACHE));
Record flags = create().select(startWith, incrementBy, minValue, maxValue, cycle, cache).from(name(schema.getName(), name)).fetchOne();
result.add(new DefaultSequenceDefinition(schema, name, type, null, flags.get(startWith), flags.get(incrementBy), flags.get(minValue), flags.get(maxValue), flags.get(cycle), flags.get(cache)));
}
}
return result;
}
Aggregations