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

Class: Tree

Source Location: /Tree-0.3.3/Tree.php

Class Overview

the DB interface to the tree class



  • 2001/06/27


Inherited Variables

Inherited Methods

Class Details

[line 29]
the DB interface to the tree class

[ Top ]

Method Detail

isError   [line 167]

bool isError( int $value)

Tell whether a result code from a DB method is an error
  • Return: whether $value is an error
  • Access: public


int   $value   —  result code

[ Top ]

setupDynamic   [line 92]

void &setupDynamic( string $type, string $dsn, [array $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 does not 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.


string   $type   —  the type of tree you want, currently only DBnested is supported
string   $dsn   —  the connection string, for DB* its a DSN, for XML it would be the filename
array   $options   —  the options you want to set

[ Top ]

setupMemory   [line 61]

void &setupMemory( string $type, [mixed $dsn = ''], [ $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 1000-5000 elements since the entire tree is read at once from the data source. Use this to instanciate a class of a tree, 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.


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'
mixed   $dsn   —  the dsn, or filename, etc., empty i.e. for XML if you use setupByRawData
   $options   — 

[ Top ]

Documentation generated on Thu, 10 Dec 2015 05:48:56 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.