use of org.jooq.util.SequenceDefinition in project jOOQ by jOOQ.
the class PostgresDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Record record : create().select(SEQUENCES.SEQUENCE_SCHEMA, SEQUENCES.SEQUENCE_NAME, SEQUENCES.DATA_TYPE, SEQUENCES.NUMERIC_PRECISION, SEQUENCES.NUMERIC_SCALE).from(SEQUENCES).where(SEQUENCES.SEQUENCE_SCHEMA.in(getInputSchemata())).orderBy(SEQUENCES.SEQUENCE_SCHEMA, SEQUENCES.SEQUENCE_NAME).fetch()) {
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));
}
return result;
}
use of org.jooq.util.SequenceDefinition in project jOOQ by jOOQ.
the class JDBCDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Schema schema : getSchemasFromMeta()) {
for (Sequence<?> sequence : schema.getSequences()) {
SchemaDefinition sd = getSchema(schema.getName());
DataTypeDefinition type = new DefaultDataTypeDefinition(this, sd, sequence.getDataType().getTypeName());
result.add(new DefaultSequenceDefinition(sd, sequence.getName(), type));
}
}
return result;
}
use of org.jooq.util.SequenceDefinition in project jOOQ by jOOQ.
the class XMLDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Sequence sequence : info().getSequences()) {
if (getInputSchemata().contains(sequence.getSequenceSchema())) {
SchemaDefinition schema = getSchema(sequence.getSequenceSchema());
DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, sequence.getDataType(), sequence.getCharacterMaximumLength(), sequence.getNumericPrecision(), sequence.getNumericScale(), false, (String) null);
result.add(new DefaultSequenceDefinition(schema, sequence.getSequenceName(), type));
}
}
return result;
}
use of org.jooq.util.SequenceDefinition in project jOOQ by jOOQ.
the class CUBRIDDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Record record : create().select(DB_SERIAL.NAME, DB_SERIAL.MAX_VAL).from(DB_SERIAL).fetch()) {
BigInteger value = defaultIfNull(record.get(DB_SERIAL.MAX_VAL, BigInteger.class), BigInteger.valueOf(Long.MAX_VALUE));
DataTypeDefinition type = getDataTypeForMAX_VAL(getSchemata().get(0), value);
result.add(new DefaultSequenceDefinition(getSchemata().get(0), record.get(DB_SERIAL.NAME), type));
}
return result;
}
use of org.jooq.util.SequenceDefinition in project jOOQ by jOOQ.
the class DerbyDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Record record : create().select(Sysschemas.SCHEMANAME, Syssequences.SEQUENCENAME, Syssequences.SEQUENCEDATATYPE).from(SYSSEQUENCES).join(SYSSCHEMAS).on(Sysschemas.SCHEMAID.equal(Syssequences.SCHEMAID)).where(Sysschemas.SCHEMANAME.in(getInputSchemata())).orderBy(Sysschemas.SCHEMANAME, Syssequences.SEQUENCENAME).fetch()) {
SchemaDefinition schema = getSchema(record.get(Sysschemas.SCHEMANAME));
DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, record.get(Syssequences.SEQUENCEDATATYPE));
result.add(new DefaultSequenceDefinition(schema, record.get(Syssequences.SEQUENCENAME, String.class), type));
}
return result;
}
Aggregations