[nycphp-talk] Managing Nested Sets in a Database
Jeff Loiselle
jeff.loiselle at gmail.com
Tue Nov 15 23:20:18 EST 2005
Hello,
So I completely understand how to add nodes, removes nodes, move
nodes, select children and parents. But I'm having a hard time
figuring out how to draw trees in select boxes and using packages like
PEAR::HTML_TreeMenu to build trees without using recursion. I'm going
brain-dead on this one. The fcnyNode class has been extremely helpful
along with the articles I'm reading which I posted before.
What's my big hangup? ;-)
/jeff
On 11/9/05, csnyder <chsnyder at gmail.com> wrote:
> On 11/9/05, Jeff Loiselle <jeff.loiselle at gmail.com> wrote:
> > Chris,
> >
> > As I've started to mess around with fncyNode a bit, it seems to work
> > well. I was wondering:
> >
> > a. I want to add a "name" column and modify the appendTo() function to
> > save it. Is there a better way? Should I be extending the class?
> >
> > b. Should I be treating this code as a sample, or is it stable for development?
> >
>
> a) I extend the class. I keep everything other than the id, parentId,
> lt and rt in another table, and use a join in order to select records.
> This keeps the node table limited to just integers, which should speed
> the massive update operations that need to be performed every time you
> insert or move a node (since fields are all fixed size). That was
> Hans' thinking, anyway (and I'm not a DB Admin).
>
> b) Aside from the addition of numChildren() the interface hasn't
> changed since last October. We've been using it all over the place for
> a year with no problems. Not high-traffic sites by any means, but
> constant daily use with no tree corruption on sets of 3000-5000 nodes.
> I've tested it up to 50,000 nodes; inserts can take 3-5 seconds at
> that size, but lookups are as fast as ever.
>
>
> --
> Chris Snyder
> http://chxo.com/
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>
--
---
Jeff Loiselle
Web Developer, Musician, and Observer
http://jeff.loiselles.com
"In America, through pressure of conformity, there is freedom of
choice, but nothing to choose from." - Peter Ustinov
More information about the talk
mailing list