之前问过一个类似的问题,但没有人回答,所以我重新考虑了这个问题,并提出了一个类似/不同的问题。
我有一个以父/根(顶部)应用程序开头的过程。然后根应用程序生成子应用程序,这些子应用程序也可以生成后代应用程序。这可以持续多个级别。然后每个级别可以是一个节点,也可以是一个叶子。一个节点可以有后代。叶子没有生成的子/后代应用程序。
在流程开始时,应用程序知道级别数。该过程也是结构化的,因此每个子应用程序都能够在完成时使用自己的 ID 和 parentID 更新 tbl。
因此,当整个流程运行时,生成的数据是一个层次树。
我试图弄清楚如何能够查看树中的给定项目/节点,并确定后代应用程序是否完整。
我正在尝试在 mysql 中完成此操作。我对存储过程/子选择不太熟悉。我看过许多讨论这个问题的在线论文/网站,但我似乎没有针对我的问题提出任何问题。
寻找 mysql 大师来帮助我弄清楚这个问题。
谢谢!
---------------------------------
The sample tree would look like:
spawn
3 levels
a - 3 copies of b
b - 3 copies of c
a(1)
|
---------------------------------------------------------------------
|b(1) |b(2) |b(3)
------------------- ------------------- --------------------
|c(1) |c(2) |c(3) c(1) |c(2) |c(3) |c(1) |c(2) |c(3)
so we have a total of 12 crawls/fetches
the levels
a
b
c
the (parent/child) levelRelationships
"",a
a,b
b,c
start level
a (parent/top)
end level
c (leaf)
operational process:
an app spawns either no child app, a single child app, or multiple child app(s)
an app that spawns children is a node
an app that spawns no children is a leaf
there is no guarantee that an app at a given level, will stop operation
before an app at a lower level started by it's parent
each child app can set a tbl with a status when it completes
when each child app is complete, it generates a "level/complete" status
which is stored in a levelStatusTBL
at the start of the root/top level process:
-the tree can have multiple/unknown levels
-each child app can spawn an unknown number of children
issue...
how to algorithmically determine when all the descendants of a root/top level function have completed?
how to algorithmically determine when all the descendants of a node have completed
我正在考虑的示例 tbls 是:
CREATE TABLE `crawlNodeChildrenCountTBL` (
`rootID` varchar(100) NOT NULL DEFAULT '',
`uCrawlID` varchar(100) NOT NULL DEFAULT '',
`childCount` int(5) NOT NULL DEFAULT 0,
`ID` int(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `EdgeNodeCheckTBL` (
`CollegeID` varchar(100) NOT NULL DEFAULT '',
`rootID` varchar(100) NOT NULL DEFAULT '',
`parentLevel` varchar(100) NOT NULL DEFAULT '',
`Level` varchar(100) NOT NULL DEFAULT '',
`nodeType` int(5) NOT NULL DEFAULT 0,
`masterParseInputUUID` varchar(100) NOT NULL DEFAULT '',
`parentSetupPreComboID` varchar(100) NOT NULL DEFAULT '',
`SetupPreComboChildStatusID` varchar(100) NOT NULL DEFAULT '',
`ID` int(10) NOT NULL AUTO_INCREMENT,
UNIQUE KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
EdgeNodeCheckTBL.SetupPreComboChildStatusID is the baseID
EdgeNodeCheckTBL.parentSetupPreComboID is the parentID of SetupPreComboChildStatusID
this is used to implement the standard child/parent relationship tbl