Skip to main content



      Home
Home » Eclipse Projects » DTP » Generic parser API
Generic parser API [message #517495] Sun, 28 February 2010 13:54 Go to next message
Eclipse UserFriend
I just figured out that DTP uses two different kinds of SQL parsers: JavaCC and LPG based.

I have the following problem: I only have a database specific extended JavaCC-parser (extension of org.eclipse.datatools.sqltools.sql.parser.SQLParser). And my aim is to analyze a SQL query in order to print out all columns used in this query. I would easily solve this task using SQL query model, but JavaCC-parser doesn't support this...

I found the following statements in a mail thread from the Eclipse project: "a common parser API (for callers to work with any parser) is planned in the next release of DTP (post DTP 0.9)..." and "...The generic sql parser API will help us to achieve this goal. DTP will only interact with the parser using the generic parser API, no matter what the underlying parser it is".

These mails were written on the June 1, 2006. Now DTP 1.7 is there. Is generic parser API already implemented? Or is there any chance to use the existing AST (parsing tree) from JavaCC-based parser for the recognition of QueryStatement?
Re: Generic parser API [message #525857 is a reply to message #517495] Wed, 07 April 2010 21:46 Go to previous messageGo to next message
Eclipse UserFriend
Unfortunately the common parser API was never implemented.

What database type are you using? Are you analyzing SQL Select
statements only? If so, and your SQL dialect is not too non-standard,
you might be able to use the SQL Query parser and model to do the analysis.

Slavik Taubkin wrote:
> I just figured out that DTP uses two different kinds of SQL parsers:
> JavaCC and LPG based.
>
> I have the following problem: I only have a database specific extended
> JavaCC-parser (extension of
> org.eclipse.datatools.sqltools.sql.parser.SQLParser). And my aim is to
> analyze a SQL query in order to print out all columns used in this
> query. I would easily solve this task using SQL query model, but
> JavaCC-parser doesn't support this...
>
> I found the following statements in a mail thread from the Eclipse
> project: "a common parser API (for callers to work with any parser) is
> planned in the next release of DTP (post DTP 0.9)..." and "...The
> generic sql parser API will help us to achieve this goal. DTP will only
> interact with the parser using the generic parser API, no matter what
> the underlying parser it is".
>
> These mails were written on the June 1, 2006. Now DTP 1.7 is there. Is
> generic parser API already implemented? Or is there any chance to use
> the existing AST (parsing tree) from JavaCC-based parser for the
> recognition of QueryStatement?
Re: Generic parser API [message #525947 is a reply to message #525857] Thu, 08 April 2010 07:23 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for the reply!
I have to analyse different kinds of statements (including DELETEs, UPDATEs, INSERTs). I "solved" this problem by splitting the original statement into smaller pieces that can be parsed with the generic parser.

Regards,
Slavik
Re: Generic parser API [message #526153 is a reply to message #525947] Thu, 08 April 2010 20:38 Go to previous message
Eclipse UserFriend
OK, glad you have it working. When you say the generic parser, which
parser do you mean?

BTW, the SQLQueryParser (the LPG-based one) is designed to parse SELECT,
INSERT, UPDATE, DELETE, and MERGE statements. And the classes in the
"helper" package in org.eclipse.modelbase.sql.query plugin are designed
to get information from a generated query model such as all the column
references in a statement.

Slavik Taubkin wrote:
> Thank you for the reply!
> I have to analyse different kinds of statements (including DELETEs,
> UPDATEs, INSERTs). I "solved" this problem by splitting the original
> statement into smaller pieces that can be parsed with the generic parser.
>
> Regards,
> Slavik
Re: Generic parser API [message #597405 is a reply to message #525857] Thu, 08 April 2010 07:23 Go to previous message
Eclipse UserFriend
Thank you for the reply!
I have to analyse different kinds of statements (including DELETEs, UPDATEs, INSERTs). I "solved" this problem by splitting the original statement into smaller pieces that can be parsed with the generic parser.

Regards,
Slavik
Re: Generic parser API [message #597416 is a reply to message #525947] Thu, 08 April 2010 20:38 Go to previous message
Eclipse UserFriend
OK, glad you have it working. When you say the generic parser, which
parser do you mean?

BTW, the SQLQueryParser (the LPG-based one) is designed to parse SELECT,
INSERT, UPDATE, DELETE, and MERGE statements. And the classes in the
"helper" package in org.eclipse.modelbase.sql.query plugin are designed
to get information from a generated query model such as all the column
references in a statement.

Slavik Taubkin wrote:
> Thank you for the reply!
> I have to analyse different kinds of statements (including DELETEs,
> UPDATEs, INSERTs). I "solved" this problem by splitting the original
> statement into smaller pieces that can be parsed with the generic parser.
>
> Regards,
> Slavik
Previous Topic:H2 enablement
Next Topic:H2 enablement
Goto Forum:
  


Current Time: Sat Jul 05 03:12:28 EDT 2025

Powered by FUDForum. Page generated in 0.04937 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top