I am using JSqlParser 3.0 and my query is SELECT * from [dev-testdb].dbo.EMPLOYEES. I am trying to remove [] characters because JSqlParser 3.0 version is not supported for these characters.I guess 1.x does but I have to use 3.0.
After remove brackets, my query seems like SELECT * from dev-testdb.dbo.EMPLOYEES .
I am debugging my project and on this command
final Statement statement = CCJSqlParserUtil.parse(sql);
I catch this exception
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "-" "-"
at line 1, column 18.
How can I fix this 3 characters when I parse with JSqlParser?
It is not an issue of JSqlParser but its evolution. :)
Bracketquotation was switched off by default, to support all kinds of array syntax, which uses in most cases square brackets as well. This change was introduced with JSqlParser 3.0.
Here is the discussion: https://github.com/JSQLParser/JSqlParser/issues/677.
To activate this bracket quotation again use something like:
The lambda expression is used to somehow modify the used parsers configuration.