Tree
[ class tree: Tree ] [ index: Tree ] [ all elements ]

Class: Tree

Source Location: /Tree-0.1.1/Tree.php

Class Overview

PEAR
   |
   --Tree

the DB interface to the tree class


Author(s):

Version:

  • 2001/06/27

Methods


Inherited Variables

Inherited Methods


Class Details

[line 31]
the DB interface to the tree class


[ Top ]


Method Detail

setupDynamic   [line 84]

void &setupDynamic( mixed $type, mixed $dsn, [mixed $options = array()])

setup an object that works on trees where each element(s) are read on demand from the given data source

actually this was intended to serve for nested trees which are read from the db up on demand, since it doesnt make sense to read a huge tree into the memory when you only want to access one level of this tree

in short: an instance returned by this method works on a tree by mapping every request (such as getChild, getParent ...) to the data source defined to work on


[ Top ]

setupMemory   [line 61]

void &setupMemory( string $type, [$dsn $dsn = ''], [mixed $options = array()])

setup an object which works on trees that are temporarily saved in memory dont use with huge trees, suggested is a maximum size of tree of about 1000-5000 elements since the entire tree is read at once from the data source.

use this to instanciate a class of a tree if you i.e.

  • need the entire tree at once
  • want to work on the tree w/o db-access for every call
since this set of classes loads the entire tree into the memory, you should be aware about the size of the tree you work on using this class for one you should know how efficient this kind of tree class is on your data source (i.e. db) and what effect it has reading the entire tree at once. on small trees, like upto about 1000 elements an instance of this class will give you very powerful means to manage/modify the tree, no matter from which data source it comes, either from a nested-DB, simple-DB, XML-File/String or whatever is implemented


Parameters:

string   $type     the kind of data source this class shall work on initially, you can still switch later, by using "setDataSource" to i.e. export data from a DB to XML, or whatever implementation might exist some day currently available types are: 'DBsimple', 'XML' TODO: DBnested (which i think should be implemented after Dynamic/DBnested, since it would only need to use it's methods to manage the tree)
$dsn   $dsn     the dsn, or filename, etc., empty i.e. for XML if you use setupByRawData

[ Top ]


Documentation generated on Fri, 30 Apr 2004 21:33:54 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.