MLDBM::TinyDB is a Perl module that can help you to create and manipulate structured MLDBM tied hash references.
SYNOPSIS
use MLDBM::TinyDB;
## or
use MLDBM::TinyDB qw/db add_common/;
@common = qw/created updated/; ## optional
$tree = [TABLE, FIELDS_LIST,
[TABLE1, FIELDS_LIST1,
[TABLE2, FIELDS_LIST2],
...
],
...
];
MLDBM::TinyDB::add_common($tree,@common); ## optional
## or
add_common($tree,@common);
%obj = ();
$obj{TABLE} = MLDBM::TinyDB->init(TABLE, $tree);
## or
$obj{TABLE} =
MLDBM::TinyDB->init(TABLE, $tree, undef, $mode, $perms);
## or
$obj{TABLE} = MLDBM::TinyDB->init(TABLE); ## NEVER FIRST TIME
@down = $obj{TABLE}->down; ## TABLE1
$obj{TABLE1} = MLDBM::TinyDB::db(TABLE1);
## or
$obj{TABLE1} = db(TABLE1);
$table = $obj{TABLE}->table; ## TABLE
@down = $obj{TABLE1}->down; ## TABLE2
$obj{TABLE2} = MLDBM::TinyDB::db(TABLE2);
## or
$obj{TABLE2} = db(TABLE2);
@set_recs_indices =
$obj{TABLEn}->set_recs(ARRAYREF_TO_HASHREF,[LIST]);
$up = $obj{TABLE2}->up; ## TABLE1
$aref_of_href = $obj{TABLE}->get_ext_recs;
## or
($aref_of_href, @get_recs_indices) = $obj{TABLE}->get_ext_recs;
$aref_of_href1 = $obj{TABLE}->get_recs; ## NOT THE SAME AS ABOVE
## or
($aref_of_href1, @get_recs_indices1) = $obj{TABLE}->get_recs;
@indices_of_recs_found = $obj{TABLE}->search($criteria, [$limit]);
@indices_of_recs_found = $obj{TABLE}->lsearch($criteria, [$limit]);
@indices_and_sort_field_values = $obj{TABLE}->sort($sort_formula_string);
@indices_and_sort_field_values = $obj{TABLE}->lsort($sort_formula_string);
$obj{TABLEn}->delete([LIST]);
$obj{TABLEn}->last;
MLDBM::TinyDB is MLDBM based module. It allows to create/manipulate data structure of related tables = more-then-flatfile-database. The main idea is to create array reference which will reflect database structure. The first scalar value in the array is table name, next ones are fields names - if the array contains array reference it denotes interior (related) table where first scalar value is that table name (in that case the record will contain the field of the same name as interior table) and the next ones are fields names and so on... If database structure isn't written on disk then that structure is fetched from the array reference and written to disk.
Object is always built from disk structures. To define record you may use any field name except "nodes" which is restricted field name and shouldn't be specified explicitly. created and updated fields are handled internally - if they are specified then: 1)on append record operation time function value is set to created record field 2)on write to existing record operation time function value is set to updated record field. Data get from and set to records are in form of array reference to hash references where hash keys are fields names. The fields names that are interior tables names contain array references. That array store indices (similar to array indices) identifying particular records. Those fields MUST be set to proper values before write records set_recs operation.
Product's homepage
Requirements:
· Perl