Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Tree Structure and Dbby ikegami (Patriarch) |
on Jul 05, 2005 at 21:31 UTC ( [id://472616]=note: print w/replies, xml ) | Need Help?? |
If you're primarily going to read the tree, it might be advantageous to store pointers to every ancestor instead of just the direct parent. You can query for all the ancestors in one query, and then build the path in Perl. For example,
This way, you can easily fetch an entire subtree. For example,
You can still fetch only the immediate children. For example,
Similar for the immediate parent.
In Section
Seekers of Perl Wisdom
|
|