Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dtp-dev] how to use parser of datatools.

Thanks a lot. This is really helpful.

Ben

On Fri, Mar 19, 2010 at 5:59 PM, Brian Payton <bpayton@xxxxxxxxxx> wrote:
You can use parserManager.parseScript, which accepts a "script" containing a list of statements and returns a list of SQLQueryParseResult objects.  You can then iterate through the list of SQLQueryParseResult objects, get eachQueryStatement.from the parse result, and use the getTablesForStatement on it.

Unfortunately I don't know of any maven packages for data tools.

You might find more examples about data tools in the various EclipseCon presentations.  Look for presentations related to "DTP", "data tools", or "datatools",

Regards,
Brian

Brian Payton
Data Tools Development
IBM Silicon Valley Laboratory






From:        Benyi Wang <bewang.tech@xxxxxxxxx>
To:        dtp-dev@xxxxxxxxxxx
Date:        03/19/2010 04:43 PM
Subject:        [dtp-dev] how to use parser of datatools.
Sent by:        dtp-dev-bounces@xxxxxxxxxxx




I want to use sql parser to parse a SQL script (multiple statements) then get what tables are referenced in the script.

The target database will be DB2 or MSSQL.

I found I can parse the query
QueryStatement queryStmt = parserManager.parseQuery("SELECT SUBQRY.* FROM (SELECT COL1, COL2 FROM TABLEA) AS SUBQRY");


then use
org.eclipse.datatools.modelbase.sql.query.helper.StatementHelper.getTablesForStatement
My questions:
1. How to parse multiple statements?
2. I'm using Maven for my project. Are there maven packages for datatools? 
3. Where can I find more examples about datatools?
Thanks._______________________________________________
dtp-dev mailing list
dtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dtp-dev


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



Back to the top