NYCPHP Meetup

NYPHP.org

[nycphp-talk] Managing Nested Sets in a Database

csnyder chsnyder at gmail.com
Wed Nov 9 13:24:28 EST 2005


On 11/9/05, csnyder <chsnyder at gmail.com> wrote:

> I'm supposed to publish a much more recent implementation that I've
> been working with, but I haven't had time to put the site together.

As a followup, you'd probably want the table structure...

CREATE TABLE `fcnyNode` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `parentId` int(10) unsigned default NULL,
  `lt` int(10) unsigned default NULL,
  `rt` int(10) unsigned default NULL,
  PRIMARY KEY  (`id`)
) TYPE=InnoDB

It has to be InnoDB because transactions are necessary to ensure that
the tree doesn't get corrupted during moves.

--
Chris Snyder
http://chxo.com/


More information about the talk mailing list