Skip to content

Sample on how to properly process a join clause #9

Description

@rrozema

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"]} ]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions