I am using org.teiid.query.parser.QueryParser to parse a SQL string into Query object. It works fine for ansi quoted identifiers (double quotes). However, it is throwing error while parsing the identifiers quoted with square brackets, single quotes and backticks.
Getting the below error: java.lang.Exception: org.teiid.api.exception.query.QueryParserException: TEIID31100 Parsing error: Encountered "select [*][[*]dbo.empid]" at line 1, column 8. Was expecting: "char" | "date" | "time" | "timestamp" | "cast" | "convert" | "all" | "any" | "array" | "array_agg" ...
This is how I am using it: Query query = (Query)QueryParser.getQueryParser().parseCommand(sqlString, new ParseInfo());
The ParseInfo paramenter in above statement has ANSI_QUOTED_DEFAULT property as true due to which it is able to parse the sql string with double quoted identifiers. For e.g: Select "dbo.empid" From "dbo"."Emp" "Ex"
My application requires to parse SQL strings with other types of quoting as given below.
Square brackets: select [dbo.empid] From [dbo].[Emp] [Ex]
Single quotes: Select 'dbo.empid' From 'dbo'.'Emp' 'Ex'
Backticks: Select
dbo.empid
Fromdbo
.Emp
Ex
The Query parser is not parsing the above three sql statements.
Is there any teiid property setting or any other teiid configuration required in the code to allow any type of quoting?