> > You may want to check out using Nested Sets instead of a
> > system.
> This is OK for some simple trees, however it does have some
> (1) Adding another tree / series of nodes into the middle if the set.
Not if you can define what the absolute max size of a node will be. I've
been looking to using this for the military, to represent the chain of
command. The structure of the military would be like this:
1)Army, 2)Corp, 3)Division, 4)Brigade, 5)Battalion, 6)Company,
7)Platoon, 8)Squad, 9)Individual
So I define a squad to have 50 "elements", a platoon to have 10 squads,
a company to have 10 platoons. Normally, these would have a lot less
than that, but I've built in some extra space. So if I create a company,
it gets node number of 6-5006. (Company is number 6 above, this allows
you to add nodes above this one, also, that contain this one) So it has
5000 spaces in it. The first platoon would have node number of 7-507.
First squad has 8-58. So to add in another platoon, simply select the
max number under the company you want to add it to. In this case, it
would be 507. So, even with data already there, the next platoon added
would have node number of 508-1008. You can still do all of the regular
nest set queries, too.
> (2) A child node that belongs to more than one parent.
Again, not really. In the above example, I give a certain company the
node numbers of 6-5006. Now assign that left and right pair a unique id.
Now you can have multiple people with that same ID. So you can have 3
managers at the same level, associated with the same unique id and left
right pair, and be in charge of the same people.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php