Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to find all subqueries #2023

sampsonsl started this conversation in General
Discussion options

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.

You must be logged in to vote

Replies: 1 comment

Comment options

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

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /