The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tree::Persist::DB::SelfReferential - a handler for Tree persistence

SYNOPSIS

Please see Tree::Persist for how to use this module.

DESCRIPTION

This module is a plugin for Tree::Persist to store a Tree to a self-referential DB table. This is where a table contains an id column for the row and a parent_id column that refers back to another row's id (which is the parent row).

This is the simplest way to store a tree datastructure in a database.

PARAMETERS

In addition to any parameters required by its parent Tree::Persist::DB, the following parameters are required by connect():

  • id (required)

    This is the id for the root node of the tree. By specifying this, you can both store more that one tree in a table as well as only load a subtree.

  • id_col (optional)

    This is the column name for the id field. It defaults to "id".

  • parent_id_col (optional)

    This is the column name for the parent_id field. It defaults to "parent_id".

  • value_col (optional)

    This is the column name for the value field. It defaults to "value".

  • class_col (optional)

    This is the column name for the class field. It defaults to "class".

TODO

  • To date, only MySQL has been tested.

  • Provide for a way to default the class to 'Tree' if no class_col is provided. Also, allow for the classname to be passed into the constructor.

BUGS/TODO/CODE COVERAGE

Please see the relevant sections of Forest.

AUTHORS

Rob Kinyon <rob.kinyon@iinteractive.com>

Stevan Little <stevan.little@iinteractive.com>

Thanks to Infinity Interactive for generously donating our time.

COPYRIGHT AND LICENSE

Copyright 2004, 2005 by Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.