Hello all,
I am currently looking for an SQL parser written in Java, preferably
with source code. What I want to do is to infer (as far as possible)
the schema from an SQL DML statement. The parser should give me some
nice, traversable Java object tree/abstract syntax tree.
So far I only found sql4j and Zql, which both are very old and do not
parse my statements.
Anyone can give me some pointers? Here is a list of things that the
parser should be able to parse:
* CASE statements in the SELECT as well as in the WHERE clause
* subselects, exists, not exists, ...
* column and table aliasing
* grouping and aggregate functions
Thanks for your help,
Boris Stumm
Dyreatnews@sun.com - 30 Nov 2007 18:19 GMT
> Hello all,
>
[quoted text clipped - 13 lines]
> * column and table aliasing
> * grouping and aggregate functions
Derby uses javacc with an SQL grammar file which you could look at.
See http://db.apache.org/derby/dev/derby_source.html
You'll probably have to do quite a bit of tweaking to make it suit
your needs, though...

Signature
dt