NAME

Genezzo::Dict.pm - The Genezzo data dictionary

SYNOPSIS

use Genezzo::Dict;

# create a new dictionary

my $dictobj = Genezzo::Dict->new(
                 gnz_home => $gnz_home, 
                 init_db => $init);

# see if a table exists

if ($dictobj->DictTableExists (
                  tname => $tablename,
                  silent_exists => 0,
                  silent_notexists => 1 )))...

# create a new table

$dictobj->DictTableCreate (
                  tname => $tablename,
                  tabdef => \%coldatatype,
                  tablespace => "SYSTEM");

# drop a table

$dictobj->DictTableDrop (tname => $tablename);

# save the state of the dictionary to disk

$dictobj->DictSave();

my $colhash = 
    $dictobj->DictTableGetCols (tname => $tablename);

$dictobj->RowInsert (tname => $tablename, 
                     rowval => \@rowarr );

$dictobj->RowDelete (tname => $tablename, 
                     rid => $rid);

$dictobj->RowUpdate (tname => $tablename, 
                     rid => $rid,
                     rowval => \@rowarr);

# return the table as a tied hash

my $tablehash = 
    $dictobj->DictTableGetTable (tname => $tablename) ;

DESCRIPTION

The dictionary is a complete description of the Genezzo system, recording information on table structure and physical layout. It provides an interface to create, destroy, query, and manipulate tables.

Dictionary concepts

Tablespace -- a physical space to store the contents of tables. A tablespace is a collection of files. The default install of Genezzo creates a single SYSTEM tablespace in a single file.

Core Tables

The dictionary itself is just a set of tables stored in the system tablespace. Genezzo only uses six core tables to describe its basic dictionary. NOTE: Modifying any dictionary tables will framboozle your nimwits. You have been warned.

_pref1 -- a set of key/value pairs that describe the database configuration
_tspace -- the list of tablespaces for this Genezzo instance.
_tsfiles -- the list of files which compose each tablespace
_tab1 -- the list of tables and their associated tablespaces
_col1 -- the list of columns for each table
allfileused -- the list of files actually used by each table

FUNCTIONS

I want to reduce the interface to a simple tied hash, something like:

    my $errormsg;
    
    %args = (errormsg => \$errormsg );
    
    my $dicthash = DictGetDictHash(%args);

Checking for the existance of a table would be something like:

    my $tablename = "kitchentable";
    
    if (exists($dicthash->{tableinfo}->{$tablename}))
    {
       # do stuff...
    }
    else
    {
       # errormsg was reference in tie of dicthash, 
       # contains last error status
       print $errormsg;
    }

EXPORT

TODO

DictTableAllTab: need index on allfileused for delete
DictTableAllTab: update tsfiles for usefile
need some combo _get_table/corecolnum/getcol - create a custom iterator that returns specified cols
non-unique index support using bt2 use_keycount. Need to separate notion of SQL uniqueness from btree concept of unique, since a non-unique SQL index is a unique btree with the rid as least-significant key col (vs rid as value col).
need drop table/drop index linkage, delete constraints for table, etc
check usage of HCount for max tid, max fileidx, max consid. This won't work if have deletions

AUTHOR

Jeffrey I. Cohen, jcohen@genezzo.com

SEE ALSO

perl(1).

Copyright (c) 2003, 2004 Jeffrey I Cohen. All rights reserved.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Address bug reports and comments to: jcohen@genezzo.com

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 3694:

'=item' outside of any '=over'

Around line 3699:

You forgot a '=back' before '=head2'

Around line 3706:

'=item' outside of any '=over'

Around line 3720:

You forgot a '=back' before '=head1'