Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » Need help using SQL parser(SQL Parser)
Need help using SQL parser [message #486997] Mon, 21 September 2009 12:57 Go to next message
aiquefernandez  is currently offline aiquefernandez
Messages: 4
Registered: September 2009
Junior Member
Hi.

I'm using the sql parser provided into the DTP package.

I'm trying to do a very simple execise: get the table name from a sql code. This could be:

question: select attribute from mytable
answer: mytable

I suppose that i can get it using the QuerySelect.getFromClause method, but I don't know how to parse an statement and get the QuerySelect from it.

Can anyone help me?, thanks.
Re: Need help using SQL parser [message #487116 is a reply to message #486997] Tue, 22 September 2009 00:20 Go to previous message
Brian Payton is currently offline Brian Payton
Messages: 152
Registered: July 2009
Senior Member
The answer partly depends on what kind of application you are creating.
If it is a Eclipse plugin application (that is, takes full advantage
of the Eclipse plugin environment) then I can send you some sample code.
If it's an RCP app. or a stand-alone Java app., then it will be more
difficult because of some plugin dependency issues.

Once you have the parser working, then you can use the "Helper" classes
in plugin org.eclipse.datatools.modelbase.sql.query to get whatever
information you need from the parsed query statement. For example,
"getTablesForStatement(QueryStatement stmt)" in the StatementHelper class.

aiquefernandez wrote:
> Hi.
>
> I'm using the sql parser provided into the DTP package.
>
> I'm trying to do a very simple execise: get the table name from a sql
> code. This could be:
>
> question: select attribute from mytable
> answer: mytable
>
> I suppose that i can get it using the QuerySelect.getFromClause method,
> but I don't know how to parse an statement and get the QuerySelect from it.
>
> Can anyone help me?, thanks.
Previous Topic:Install just MySQL, and no SDK
Next Topic:Need help using SQL parser
Goto Forum:
  


Current Time: Tue Oct 21 15:25:45 GMT 2014

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

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