Revision 1557
Added by Aaron Marcuse-Kubitza almost 13 years ago
vegbien.sql | ||
---|---|---|
219 | 219 |
FROM namedplace_ancestor |
220 | 220 |
WHERE namedplace_id = new.parent_id |
221 | 221 |
; |
222 |
-- Add ancestor for immediate parent |
|
222 |
-- Add "ancestor" for this node |
|
223 |
/* This is useful for queries, because you don't have to separately test |
|
224 |
if the leaf node is the one you're looking for, in addition to that leaf |
|
225 |
node's ancestors. */ |
|
223 | 226 |
INSERT |
224 | 227 |
INTO namedplace_ancestor |
225 | 228 |
(namedplace_id, ancestor_id) |
226 |
VALUES (new.namedplace_id, new.parent_id)
|
|
229 |
VALUES (new.namedplace_id, new.namedplace_id)
|
|
227 | 230 |
; |
228 | 231 |
-- Tell immediate children to update their ancestors lists, which will |
229 | 232 |
-- recursively tell all descendants |
... | ... | |
263 | 266 |
FROM plantname_ancestor |
264 | 267 |
WHERE plantname_id = new.parent_id |
265 | 268 |
; |
266 |
-- Add ancestor for immediate parent |
|
269 |
-- Add "ancestor" for this node |
|
270 |
/* This is useful for queries, because you don't have to separately test |
|
271 |
if the leaf node is the one you're looking for, in addition to that leaf |
|
272 |
node's ancestors. */ |
|
267 | 273 |
INSERT |
268 | 274 |
INTO plantname_ancestor |
269 | 275 |
(plantname_id, ancestor_id) |
270 |
VALUES (new.plantname_id, new.parent_id)
|
|
276 |
VALUES (new.plantname_id, new.plantname_id)
|
|
271 | 277 |
; |
272 | 278 |
-- Tell immediate children to update their ancestors lists, which will |
273 | 279 |
-- recursively tell all descendants |
Also available in: Unified diff
vegbien.sql: Modified tree cross-link algorithm to add an "ancestor" for this node. This is useful for queries, because you don't have to separately test if the leaf node is the one you're looking for, in addition to that leaf node's ancestors.