Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample on how to properly process a join clause #9

Open
rrozema opened this issue Jan 31, 2023 · 0 comments
Open

Sample on how to properly process a join clause #9

rrozema opened this issue Jan 31, 2023 · 0 comments

Comments

@rrozema
Copy link

rrozema commented Jan 31, 2023

Hi Arvind, Thank you very much for your samples, they are very helpful in finding how to work with the sql dom. The only thing so far I have found to be too complex is how to process a join clause: what would be a suitable override that enables me to have access to both the join clause and other references to the columns of the right table of one join clause? In particular: Can you write us a sample where a statement like for example
select a.[name], b.[name], c.[name] from dbo.tablea a left outer join (dbo.tableb b left outer join dbo.tablec c on c.id = b.cid ) on b.id = a.bid
is parsed to find which columns of each of the table instances are referenced in the search conditions and which columns are referenced otherwise? i.e. I would like to find for each table instance two lists, one of the columns used as a search condition for that table instance, and another for any remaining referenced columns. For my above example the result could look like this (written as json-like):
[ { "table" = "dbo.tablea", "alias" = "a", "search condition" = [], "referenced" = ["name", "bid" ]}, { "table" = "dbo.tableb", "alias" = "b", "search condition" = ["id"], "referenced" = ["name", "cid"]}, { "table" = "dbo.tablec", "alias" = "c", "search condition" = ["id"], "referenced" = ["name"]} ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant