An implementation of the TreeInSql pattern
We do not keep *anything* in memory here: every function call (children(), parent(), etc) will lead to an SQL request in the underlying storage.
Note that all operations here are O(1) in terms of the number SQL requests, except insertion and deletion which will be O(N).
Database setup:
- CREATE TABLE `storabletree` (
- `path` varchar(255) NOT NULL default '',
- `id` int(11) NOT NULL default '0',
- PRIMARY KEY (`path`),
- UNIQUE KEY `id` (`id`)
- ) TYPE=MyISAM COMMENT='TreeInSql implementation test (KEYLENGTH=4)';
Located in /StorableTree.php (line 54)
Storable | --StorableTree
Class | Description |
---|---|
Project | A project. |
Inherited from Storable
Storable::$_count
Storable::$_data
Storable::$_data_orig
Storable::$_db
Storable::$_dsn
Storable::$_exists
Storable::$_join
Storable::$_match
Storable::$_num_rows
Storable::$_num_rows_unlimited
Storable::$_offset
Storable::$_order
Storable::$_res
Storable::$_select
print a debug version of this leaf
This moves all the childs matching the $from pattern to the $to parent pattern
Generally, this replaces $from with $to, taking special measures that no conflict with existing targets exist.
The node exactly matching $from will not be moved, and therefore needs to be done seperatly
overload parent save function to make sure that the 'path' is
proper
change the parent of this node
this takes effect immediatly, without requiring a save()
Inherited From Storable
Storable::Storable()
Storable::backup_data()
Storable::connect()
Storable::count()
Storable::disconnect()
Storable::exists()
Storable::feed_hash()
Storable::get()
Storable::get_data()
Storable::handle_result()
Storable::is_limited()
Storable::next()
Storable::num_rows()
Storable::num_rows_unlimited()
Storable::offset()
Storable::remove()
Storable::save()
Storable::set()
Storable::set_data()
Storable::start_request()
Storable::tablename()
Storable::where_clause()
Documentation generated on Tue, 11 Jan 2005 01:38:31 -0500 by phpDocumentor 1.3.0RC3