Search in sources :

Example 1 with CreateSequenceFlagsStep

use of org.jooq.CreateSequenceFlagsStep in project jOOQ by jOOQ.

the class DefaultParseContext method parseCreateSequence.

private final DDLQuery parseCreateSequence() {
    boolean ifNotExists = parseKeywordIf("IF NOT EXISTS");
    Sequence<?> schemaName = parseSequenceName();
    CreateSequenceFlagsStep s = ifNotExists ? dsl.createSequenceIfNotExists(schemaName) : dsl.createSequence(schemaName);
    boolean startWith = false;
    boolean incrementBy = false;
    boolean minvalue = false;
    boolean maxvalue = false;
    boolean cycle = false;
    boolean cache = false;
    for (; ; ) {
        Field<Long> field;
        if (!startWith && (startWith |= (field = parseSequenceStartWithIf()) != null))
            s = s.startWith(field);
        else if (!incrementBy && (incrementBy |= (field = parseSequenceIncrementByIf()) != null))
            s = s.incrementBy(field);
        else if (!minvalue && (minvalue |= (field = parseSequenceMinvalueIf()) != null))
            s = s.minvalue(field);
        else if (!minvalue && (minvalue |= parseSequenceNoMinvalueIf()))
            s = s.noMinvalue();
        else if (!maxvalue && (maxvalue |= (field = parseSequenceMaxvalueIf()) != null))
            s = s.maxvalue(field);
        else if (!maxvalue && (maxvalue |= parseSequenceNoMaxvalueIf()))
            s = s.noMaxvalue();
        else if (!cycle && (cycle |= parseKeywordIf("CYCLE")))
            s = s.cycle();
        else if (!cycle && (cycle |= parseSequenceNoCycleIf()))
            s = s.noCycle();
        else if (!cache && (cache |= (field = parseSequenceCacheIf()) != null))
            s = s.cache(field);
        else if (!cache && (cache |= parseSequenceNoCacheIf()))
            s = s.noCache();
        else
            break;
    }
    return s;
}
Also used : CreateSequenceFlagsStep(org.jooq.CreateSequenceFlagsStep)

Aggregations

CreateSequenceFlagsStep (org.jooq.CreateSequenceFlagsStep)1