Re: PEAR::Tree limiting fetched fields
| From: | Wolfram Kriesing | Date: | Tue, 04 Feb 2003 12:33:38 +0000 |
| Subject: | Re: PEAR::Tree limiting fetched fields | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3594@lists.php.net to get a copy of this message | ||
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
... opensource @ vision:produktion ...
http://opensource.visionp.de
... translating template engine ....
http://sf.net/projects/simpletpl
... authentication system ....
http://sf.net/projects/auth