From e94c4b88f053be3fd57523a01c44a2124a054357 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 5 Mar 2024 14:49:55 +0100 Subject: [PATCH] [jOOQ/jOOQ#12851] Support interpreter --- .../main/java/org/jooq/impl/Interpreter.java | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/Interpreter.java b/jOOQ/src/main/java/org/jooq/impl/Interpreter.java index 1aa222d4c9..b1d79717dd 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Interpreter.java +++ b/jOOQ/src/main/java/org/jooq/impl/Interpreter.java @@ -929,6 +929,7 @@ final class Interpreter { MutableSequence ms = new MutableSequence((UnqualifiedName) sequence.getUnqualifiedName(), schema); + ms.dataType = query.$dataType(); ms.startWith = query.$startWith(); ms.incrementBy = query.$incrementBy(); ms.minvalue = query.$noMinvalue() ? null : query.$minvalue(); @@ -1983,14 +1984,16 @@ final class Interpreter { } } - private final class MutableSequence extends MutableNamed { - MutableSchema schema; - Field startWith; - Field incrementBy; - Field minvalue; - Field maxvalue; - boolean cycle; - Field cache; + private final class MutableSequence extends MutableNamed { + + MutableSchema schema; + DataType dataType; + Field startWith; + Field incrementBy; + Field minvalue; + Field maxvalue; + boolean cycle; + Field cache; MutableSequence(UnqualifiedName name, MutableSchema schema) { super(name); @@ -2011,15 +2014,20 @@ final class Interpreter { return interpretedSequences.computeIfAbsent(qualifiedName(), n -> new InterpretedSequence(schema.interpretedSchema())); } - private final class InterpretedSequence extends SequenceImpl { + private final class InterpretedSequence extends SequenceImpl { InterpretedSequence(Schema schema) { - super(MutableSequence.this.name(), schema, BIGINT, false, - (Field) MutableSequence.this.startWith, - (Field) MutableSequence.this.incrementBy, - (Field) MutableSequence.this.minvalue, - (Field) MutableSequence.this.maxvalue, + super(MutableSequence.this.name(), schema, + MutableSequence.this.dataType != null + ? MutableSequence.this.dataType + : (DataType) SQLDataType.BIGINT, + false, + MutableSequence.this.startWith, + MutableSequence.this.incrementBy, + MutableSequence.this.minvalue, + MutableSequence.this.maxvalue, MutableSequence.this.cycle, - (Field) MutableSequence.this.cache); + MutableSequence.this.cache + ); } } }