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
- IDXTAB indexed tables don't give a constraint error, or primary key error. They don't have constraints because they are themselves indexes. Need to give better error message.
- Fix t/Cons1 constraint error
- 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
- constraints: can fix check constraint in update case -- don't need to check insert if check columns aren't modified.
- constraints: need not null/foreign key constraints
- constraints: need to limit one primary key per table, prevent creation of duplicate indexes on same ordered key columns
- expose drop index, drop constraint. tie drop index/drop table?
- check usage of HCount for max tid, max fileidx, max consid. This won't work if have deletions
- DictTableUseFile: update space management to use this function correctly
- DictDefineCoreTabs, tsfiles: need to save file headersize as a tsfile column.
- deal with dict->{headersize} attribute in some rational way. Currently set via tablespace->TSAddFile...
AUTHOR
Jeffrey I. Cohen, jcohen@genezzo.com
SEE ALSO
perl(1).
Copyright (c) 2003, 2004, 2005 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Address bug reports and comments to: jcohen@genezzo.com
For more information, please visit the Genezzo homepage at http://www.genezzo.com
4 POD Errors
The following errors were encountered while parsing the POD:
- Around line 5022:
'=item' outside of any '=over'
- Around line 5027:
You forgot a '=back' before '=head2'
- Around line 5034:
'=item' outside of any '=over'
- Around line 5048:
You forgot a '=back' before '=head1'