db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: Using ASTParser and TreeWalker for parsing SQL query
Date Mon, 17 Jun 2013 15:09:18 GMT
On 6/17/13 7:02 AM, venu wrote:
> Hi Rick,
> My requirement is , I want to parse the SQL and get the data from the
> Treewalkers visitednodes hashmap.
> I am iterating the visitednodes hashmap and finding the columns data,tables
> data,where clause data, order by data and group by data.
> Is there any simple way to get above data other than iterating the hashmap.?
If you need to understand the structure of those clauses, then you're 
right, I think that you will need some kind of Visitor and you will want 
the Visitor logic to visit every node in the AST. I have added more 
clauses to the Visitor logic for SelectNode and ported that change to 
the 10.10 branch.  Hopefully, this will help you move forward.

> Can you provide me a simple example for getting the column data from the
> hashmap? Thanks!
> Thanks,
> Venu.
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Using-ASTParser-and-TreeWalker-for-parsing-SQL-query-tp131219p131475.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.

View raw message