Re: PEAR::Tree limiting fetched fields

From: Date: Tue, 04 Feb 2003 13:38:04 +0000
Subject: Re: PEAR::Tree limiting fetched fields
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3595@lists.php.net to get a copy of this message
Wolfram Kriesing wrote: > Jeroen Houben wrote: > > Below is my table structure. It is a simple structure to store an online > > book. Each section of the book has subsections, which also have > > subsections etc etc. PEAR::Tree would be excellent for this, but I don't > > need to fetch the actual contents of the section when generating the > > tree (it would only slow stings down when the table grows bigger) so my > > question is: Can I tell the Tree object to only select sectionID, > > ParentID and title and not all fields?? > > > > Thanks, > > > > Jeroen > > > > # > > # Table structure for table sections > > # > > > > CREATE TABLE sections ( > > sectionID smallint(5) unsigned NOT NULL auto_increment, > > parentID smallint(6) NOT NULL default '0', > > title varchar(255) default 'no title', > > content longtext, > > PRIMARY KEY (sectionID), > > KEY title (title) > > ) TYPE=MyISAM; > > sorry, but currently the Tree-package is not capable of this. It is > actually meant to handle *only* the tree in the table. > > I'd suggest you move the 'content' in a seperate table. Your SQL will > be faster too, since your table data will be less, and if you only > need the tree data at some point it might make a lot of sense. what do > you think? > > -- > Wolfram Yes I had thought of that too. It's a valid solution although I would still prefer to have one table, because it simplifies inserts and updates. From a normalisiation point of view I don't need to split my table into two different tables. I think for now I will just stick to my one table and see how performance is, I don't think I'll ever get into real performance issues as the online book I'm creating is only 4 levels deep and will have a total of +-100 entries in the database. Your class is very helpful to me, keep up the good stuff. Jeroen

« previous php.pear.general (#3595) next »