Re: PEARtree
| From: | Tomas V.V.Cox | Date: | Thu, 10 May 2001 18:07:36 +0000 |
| Subject: | Re: PEARtree | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-368@lists.php.net to get a copy of this message | ||
Jens Wolk wrote:
>
> Tomas V.V.Cox wrote:
>
> The Tree library should be a able to store its structure through a
> interface. The meaning of the above mentioned reference can be any -
> a primary key in a table, a path to a file and so on. This way
> the library can be used for any kind of data.
Ok, I misunderstand the idea. The tree doesn't store the data, only
pointers to it.
> To think of the leaves and nodes as classes extending DB_storage was probably not
> a good idea: each DB_storage descendant invokes its own SELECT
> statement on the database. This could lead to performance problems
> with large trees. Correct?
If we look at the comments tree handler of slashcode or phpslash, you
will see exactly what you are saying. There is a main select that
returns the list of comments and then there is one more select per each
comment.
Of course there would be a reason for do it in that way (perhaps someone
of you can explain me why). In a weblog I developed time ago, I prefered
to store all the comments data in an array an order it by a recursive
function (more memory cosumption but very very fast). I'm friend of this
last idea for a tree class, but perhaps some guru can say me where I'm
wrong :).
Finally we will get: a dependant method to fill the tree with pointers,
common methods to play with the tree and another dependant method to
save it back to the original source. So?
Tomas V.V.Cox