Search in sources :

Example 6 with DefaultSequenceDefinition

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

the class XMLDatabase method getSequences0.

@Override
protected List<SequenceDefinition> getSequences0() {
    List<SequenceDefinition> result = new ArrayList<>();
    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, sequence.getComment(), sequence.getStartValue(), sequence.getIncrement(), sequence.getMinimumValue(), sequence.getMaximumValue(), Boolean.TRUE.equals(sequence.isCycleOption()), sequence.getCache()));
        }
    }
    return result;
}
Also used : DefaultSequenceDefinition(org.jooq.meta.DefaultSequenceDefinition) SchemaDefinition(org.jooq.meta.SchemaDefinition) DefaultSequenceDefinition(org.jooq.meta.DefaultSequenceDefinition) SequenceDefinition(org.jooq.meta.SequenceDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) ArrayList(java.util.ArrayList) Sequence(org.jooq.util.xml.jaxb.Sequence) DataTypeDefinition(org.jooq.meta.DataTypeDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition)

Example 7 with DefaultSequenceDefinition

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

the class FirebirdDatabase method getSequences0.

@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
    List<SequenceDefinition> result = new ArrayList<>();
    for (Record record : sequences(getInputSchemata())) {
        SchemaDefinition schema = getSchemata().get(0);
        DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, FirebirdDataType.BIGINT.getTypeName());
        result.add(new DefaultSequenceDefinition(schema, record.get(RDB$GENERATORS.RDB$GENERATOR_NAME), type, null, record.get(RDB$GENERATORS.RDB$INITIAL_VALUE), record.get(RDB$GENERATORS.RDB$GENERATOR_INCREMENT), null, null, false, null));
    }
    return result;
}
Also used : DefaultSequenceDefinition(org.jooq.meta.DefaultSequenceDefinition) SchemaDefinition(org.jooq.meta.SchemaDefinition) DefaultSequenceDefinition(org.jooq.meta.DefaultSequenceDefinition) SequenceDefinition(org.jooq.meta.SequenceDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) ArrayList(java.util.ArrayList) Record(org.jooq.Record) DataTypeDefinition(org.jooq.meta.DataTypeDefinition) DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition)

Example 8 with DefaultSequenceDefinition

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

the class CUBRIDDatabase method getSequences0.

@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
    List<SequenceDefinition> result = new ArrayList<>();
    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;
}
Also used : DefaultSequenceDefinition(org.jooq.meta.DefaultSequenceDefinition) SequenceDefinition(org.jooq.meta.SequenceDefinition) DefaultSequenceDefinition(org.jooq.meta.DefaultSequenceDefinition) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) Record(org.jooq.Record) DataTypeDefinition(org.jooq.meta.DataTypeDefinition)

Aggregations

ArrayList (java.util.ArrayList)8 DefaultSequenceDefinition (org.jooq.meta.DefaultSequenceDefinition)8 SequenceDefinition (org.jooq.meta.SequenceDefinition)8 Record (org.jooq.Record)7 DefaultDataTypeDefinition (org.jooq.meta.DefaultDataTypeDefinition)7 SchemaDefinition (org.jooq.meta.SchemaDefinition)7 DataTypeDefinition (org.jooq.meta.DataTypeDefinition)6 BigInteger (java.math.BigInteger)1 Sequence (org.jooq.util.xml.jaxb.Sequence)1