Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dtp-sqldevtools-dev] Problem parsing SQL generated using SQL Builder

Hi Artem,

Was the query generated by the SQL Query Builder?  What SQL dialect are you using?  The syntax rules used by the SQL Builder and the SQL Query Parser are fairly generic.  According to the ISO SQL standard, delimited identifiers such as 'test' should be surrounded by double-quote characters.  So
SELECT ID AS ID_NEW, NAME AS NAME_NEW FROM "test".EMPLOYEES should parse OK.

Regards,
Brian

Brian Payton
SQL and XML Query Tools Development
IBM Silicon Valley Laboratory





From:        Artem Portnoy <artem.portnoy.ibi@xxxxxxxxx>
To:        dtp-sqldevtools-dev@xxxxxxxxxxx
Date:        12/11/2009 02:16 PM
Subject:        [dtp-sqldevtools-dev] Problem parsing SQL generated using SQL        Builder
Sent by:        dtp-sqldevtools-dev-bounces@xxxxxxxxxxx




Hi,

I'm using SQLQueryParserManager to parse a select statement that was generated using DTP's SQL Builder. I'm getting the following error when I parse

org.eclipse.datatools.sqltools.parsers.sql.SQLParserException: Unable to parse the input: "SELECT ID AS ID_NEW, NAME AS NAME_NEW FROM `test`.EMPLOYEES;".
    at org.eclipse.datatools.sqltools.parsers.sql.AbstractSQLParser.parser(AbstractSQLParser.java:414)
    at org.eclipse.datatools.sqltools.parsers.sql.SQLParserManager.makeAST(SQLParserManager.java:436)
    at org.eclipse.datatools.sqltools.parsers.sql.SQLParserManager.parse(SQLParserManager.java:791)
    at org.eclipse.datatools.sqltools.parsers.sql.query.SQLQueryParserManager.parseQuery(SQLQueryParserManager.java:326)
    ...
Caused by: lpg.lpgjavaruntime.BadParseException
    at lpg.lpgjavaruntime.BacktrackingParser.parse(BacktrackingParser.java:142)
    at lpg.lpgjavaruntime.BacktrackingParser.parse(BacktrackingParser.java:100)
    at org.eclipse.datatools.sqltools.parsers.sql.AbstractSQLParser.parser(AbstractSQLParser.java:384)

I believe the problem is caused by the presence of backticks in the statement. The error goes away when I remove the backtick characters, which is the workaround I'm currently using. This does seem to be a problem since usage of backticks is valid in SQL.

Regards,

Artem Portnoy
_______________________________________________
dtp-sqldevtools-dev mailing list
dtp-sqldevtools-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dtp-sqldevtools-dev


Back to the top