[jOOQ/jOOQ#16535] Parser fails to parse TIME[STAMP] WITH TIME ZONE literals
This commit is contained in:
parent
1ebf4805dd
commit
166ee5da84
@ -510,6 +510,8 @@ import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.OffsetTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@ -10811,6 +10813,9 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
if (parseKeywordIf("WITHOUT TIME ZONE")) {
|
||||
return inline(parseTimestampLiteral());
|
||||
}
|
||||
else if (parseKeywordIf("WITH TIME ZONE")) {
|
||||
return inline(parseTimestampTZLiteral());
|
||||
}
|
||||
else if (parseIf('(')) {
|
||||
Field<?> f = parseField();
|
||||
parse(')');
|
||||
@ -10837,6 +10842,15 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
private final OffsetDateTime parseTimestampTZLiteral() {
|
||||
OffsetDateTime timestamp = Convert.convert(parseStringLiteral(), OffsetDateTime.class);
|
||||
|
||||
if (timestamp == null)
|
||||
throw exception("Illegal timestamp literal");
|
||||
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
private final Field<?> parseFieldTimeLiteralIf() {
|
||||
int p = position();
|
||||
|
||||
@ -10844,6 +10858,9 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
if (parseKeywordIf("WITHOUT TIME ZONE")) {
|
||||
return inline(parseTimeLiteral());
|
||||
}
|
||||
else if (parseKeywordIf("WITH TIME ZONE")) {
|
||||
return inline(parseTimeTZLiteral());
|
||||
}
|
||||
else if (parseIf('(')) {
|
||||
Field<?> f = parseField();
|
||||
parse(')');
|
||||
@ -10870,6 +10887,15 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
return time;
|
||||
}
|
||||
|
||||
private final OffsetTime parseTimeTZLiteral() {
|
||||
OffsetTime time = Convert.convert(parseStringLiteral(), OffsetTime.class);
|
||||
|
||||
if (time == null)
|
||||
throw exception("Illegal time literal");
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
private final Field<?> parseFieldIntervalLiteralIf(boolean parseUnknownSyntaxAsIdentifier) {
|
||||
int p = position();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user