Eclipse Data Tools Project - SQL Query Parser

Most recently discovered the SQL Query Parser classes in a DTP project, and it looks like a great (and unique) project.

My problem is that I need to analyze and see if I can combine some fairly hairy SQL fragments that are used in a large system. I need a smart and capable parser, so I can do an accurate analysis and determine if I can combine some of these fragments together to improve performance. I have already defined the analysis that I need to perform; however parser as-is cannot parse these fragments because they use certain OLAP db2 functions ( over(), partition byetc.), so I need to include db2 plugins in my code.

How it's done? I was not able to find the classes ( org.eclipse.datatools.sqltools.parsers.sql.query.db2.*) anywhere, and I also do not know how to register them (I try to do this manually, but of course, he cannot find the corresponding class.)

This is what I am doing right now, that I know is wrong, but I did not find documentation about this:

SQLQueryParserManagerProvider provider = SQLQueryParserManagerProvider
        .getInstance();

provider.registerParserManager(
        "org.eclipse.datatools.sqltools.parsers.sql.query.db2",
        "DB2 UDB", null, null);

SQLQueryParserManager parserManager = SQLQueryParserManagerProvider
        .getInstance().getParserManager("DB2 UDB", null);

Can you indicate how to get an adequate parser for parsing DB2?

Edit: Probably the right question: how can I make sure that a particular db2 provider is correctly registered? what class name?

+5
source share
1 answer

Design a project called SQLWorkBench / J sources. They have db-specific SQL parsing capabilities.

+1
source

All Articles