Hello
I am trying to implement Joe Celko's Nested set model to create a treemenu. I read the article at http://www.dbmsmag.com/9604d06.html, and I am trying to delete a single node (have't yet tried to delete a subtree). I use the procedure from the article, and it seems to fill in the gap ok, but the problem is that the ancestors are not updated. I think I read in a post somewhere at the forum, by Mr. Celko, that the ancestors need not be updated, but he also states in the article that the root node's right is always n*2. Do I have to update the ancestors, or can I leave them alone? Does anyone have some cut & paste code they can provide to help me out?
Thanks in advance.
--Shai`tan--Celko's description of the nested set model looks pretty cool, and is probably more efficient than the adjacency model in many cases, but unless you are dealing with absolutely gigantic tables the adjacency method is more than satisfactory for storing tree structures. It is certainly easier to visualize, which means it is easier to code for and easier to debug, and these advantages cannot be lightly dismissed.
I have personally never seen the nested set model implemented.
blindman
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment