-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
I'm working on a program that finds specific clauses in queries and the columns used in them. It seems to work for the top level PlainSelect. Now I need to iterate through each subquery as well. How is that done? i.e. How to iterate through all PlainSelects.
Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Greetings!
Have a look at the SelectDeparser
class which implements the Visitor pattern to traverse the AST.
You can easily overwrite any method visit(Select select)
according to your needs.
Be aware, that Select
can appear as Statement
, Expression
, LateralSubSelect
and FromItem
and you will need to implement/overwrite all those Visitors.
Here is a good starting point: https://manticore-projects.com/JSQLParser/usage.html#use-the-visitor-patterns
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1