HomeActive Query Builderrelationship between the tables

relationship between the tables


How to get the information relationship between the tables contained in QueryBuilder

Benedito Santana | email
November 18 2009, 07:49 AM
Dear Benedito,

Please find the following code in the LoadUnionSubQuery procedure (Non-visual demo):

if (unionSubQuery.FromClause.Count > 0)
LoadFromGroup(listNode.Nodes, unionSubQuery.FromClause);

The LoadFromGroup procedure iterates through all datasources and retrieves join infrmation as well.
Sergey Smagin | email
17 hours, 58 mins since original post
Hi Sergey,

I could not find this namespace

Can you guide?

Benedito Santana | email
1 day, 4 hours since original post
Dear Bene,

Please open the Non-Visual Demo, Form1.cs source code and find a bunch of procedures intended for SQL query analysis:
AnalyzeQuery, LoadQuery, LoadUnionGroup, LoadUnionSubQuery, LoadFromGroup.

The LoadUnionSubQuery retrieves all information about single sub-query. There's a comment mark "// FROM clause"; the code after that mark uses LoadFromGroup procedure to load information about datasources and their relationships.

Note: if you don't need to analyze the whole query structure with all sub-queries and unions, you may simply call use the queryBuilder.Query.FirstSelect to get quick access to the main query:

LoadUnionSubQuery(f.treeView1.Nodes, queryBuilder.Query.FirstSelect);
Sergey Smagin | email
1 day, 18 hours since original post
This topic is closed