The parser now supports parsing the TIMESTAMPDIFF() function, which is
mapped to DSL#timestampDiff().
This commit is contained in:
Knut Wannheden 2019-06-07 15:23:47 +02:00
parent a1c54350a5
commit bb871723a7

View File

@ -5743,6 +5743,8 @@ final class ParserImpl implements Parser {
return field;
else if ((field = parseFieldToTimestampIf(ctx)) != null)
return field;
else if ((field = parseFieldTimestampDiffIf(ctx)) != null)
return field;
if (N.is(type) || D.is(type))
if ((field = parseFieldTruncIf(ctx)) != null)
@ -7065,6 +7067,20 @@ final class ParserImpl implements Parser {
return null;
}
private static final Field<?> parseFieldTimestampDiffIf(ParserContext ctx) {
if (parseFunctionNameIf(ctx, "TIMESTAMPDIFF")) {
parse(ctx, '(');
Field<Timestamp> ts1 = (Field<Timestamp>) parseField(ctx, Type.D);
parse(ctx, ',');
Field<Timestamp> ts2 = (Field<Timestamp>) parseField(ctx, Type.D);
parse(ctx, ')');
return DSL.timestampDiff(ts1, ts2);
}
return null;
}
private static final Field<?> parseFieldRtrimIf(ParserContext ctx) {
if (parseFunctionNameIf(ctx, "RTRIM")) {
parse(ctx, '(');