-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
Hi Team,
I am working on a task where I am reading more than 800 sqls and these sqls are having very long in nature and each sql is having keywords like case/when , Union , nested select , group by , where , with cte , joins etc.
Can this library parse bigger sql ? and after parsing can I get information like how many select statements are there and from that select how many select columns , how many tables from From clause , how many condition in AND/OR.
I need to get all such information.
I am new to this library , Can you kindly help to get this information? Is it possible and can i get this information?
Many Thanks
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 7 replies
-
Greetings!
I am working on a task where I am reading more than 800 sqls and these sqls are having very long in nature and each sql is having keywords like case/when , Union , nested select , group by , where , with cte , joins etc. Can this library parse bigger sql ?
Yes.
and after parsing can I get information like how many select statements are there and from that select how many select columns , how many tables from From clause
Yes.
, how many condition in AND/OR
Yes.
. I need to get all such information. I am new to this library , Can you kindly help to get this information? Is it possible and can i get this information?
Yes.
Please refer to https://manticore-projects.com/JSQLParser/usage.html for details.
Beta Was this translation helpful? Give feedback.
All reactions
-
I suggest to use this link
It will visualize the Java Object Tree and the Hierarchy of classes ("Show AST" Button):
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks for reply, will explore.
Beta Was this translation helpful? Give feedback.
All reactions
-
This is perfectly giving the AST tree , but in order to get attributes of complex queries , do i need to write my own visitor or how to use existing ? Because i am trying to understand how it is generating a good tree and once it generates in order to traverse how to know how many selects/subselects/expressions are there.
I mean how to traverse to all the elements , is there any code sample available ?
Please reply.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
-
Request you to please reply
Beta Was this translation helpful? Give feedback.
All reactions
-
Greetings.
I have sent you a link showing code examples, how to traverse the AST and how to access the Objects.
I have also shown the visualisation for any AST, which will guide you.
You will need to ask much more specific questions, when you need help beyond that.
Beta Was this translation helpful? Give feedback.