//this builds a map of all objects that are grouped, public void build_map(models.table t, int depth = 0, int column = 0, int column_count = 1) { nodes.Add(new map_node(t, depth, column, column_count)); depth++; int child_column_count = t.fk_link_count; t.flag1 = true; foreach (column c in t.columns) { if (c.has_fk) { models.table fk_t = project.get_table_fk_parent(c); if (!fk_t.flag1 && null != fk_t) { build_map(fk_t, depth, column++, child_column_count); } } if (c.fk_children_count > 0) { foreach (fk child in c.fk_children) { models.table c_t = project.get_table(child.db, child.table); if (!c_t.flag1 && null != c_t) { build_map(c_t, depth, column++, child_column_count); } } } } }
public map_node(models.table t, int depth, int column, int column_count) { this.t = t; this.line = depth; this.column = column; this.column_count = column_count; }
//This recursivly maps the entire jobject for ALL connected objects. MArks each by the group that connects them. public void traverse_group(models.table t, string group) { t.group = group; foreach (column c in t.columns) { if (c.has_fk) { models.table fk_t = project.get_table_fk_parent(c); if (fk_t.group == null && null != fk_t) { traverse_group(fk_t, group); } } if (c.fk_children_count > 0) { foreach (fk child in c.fk_children) { models.table c_t = project.get_table(child.db, child.table); if (c_t.group == null && null != c_t) { traverse_group(c_t, group); } } } } }