Skip to content

Fixes 649 to add support for HOUR, MINUTE, SECOND date literals and s…#756

Merged
wumpz merged 1 commit intoJSQLParser:masterfrom
thebiguno:master
Feb 25, 2019
Merged

Fixes 649 to add support for HOUR, MINUTE, SECOND date literals and s…#756
wumpz merged 1 commit intoJSQLParser:masterfrom
thebiguno:master

Conversation

@thebiguno
Copy link
Copy Markdown
Contributor

…upport for identifiers as the interval parameter.

See my comments in issue #649.

If you add <S_IDENTIFIER> to the line ( token=<S_LONG> | token=<S_DOUBLE> | token=<S_CHAR_LITERAL> | token = <S_IDENTIFIER>) it fixes many of the issues we are seeing (most of the time we use a single identifier as the offset value; it is a less frequent case that we use an expression).

A test case for this scenario is:

select current_date + foo day as next_day from foo

It still does not work for expressions. I tried adding support for an expression directly there, but it gives a left parse error when reading the .jj file. I tried wrapping the expression in brackets (accepted but not required in DB2), and everything compiled but tests started to fail - it looks like the parser was getting confused.

Anyway, the S_IDENTIFIER change works for most of our reports. There are now only 11 out of 1553 reports which fail to parse.

…upport for identifiers as the interval parameter.
@thebiguno thebiguno mentioned this pull request Feb 25, 2019
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.2%) to 83.748% when pulling 6ddc584 on thebiguno:master into c85e79b on JSQLParser:master.

@wumpz wumpz merged commit cbcf0a7 into JSQLParser:master Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants