NAME

TBD::DBI - support of tables of relational databases (via DBI)


SYNOPSIS

   $t = new TBD::DBI::MyRelationalDatabase(
      database => $data_source, # 1st parameter of DBI->connect
      login => $login,          # 2nd parameter of DBI->connect
      auth => $auth,            # 3rd parameter of DBI->connect
      table => $tables[0],      # name of the database table
      tablename => $tables[0],  # to be registered under this name
   );


DESCRIPTION

TBD::DBI supports all DBI implementations for TBI but is by itself not a full implementation because there is no portable method to extract meta informations from a relational database. Therefore, a derived module of TBD::DBI is required that provides following methods:

initialize1

(or initialize2 -- that does not matter) is expected to set the component keyfields.

tables

is a class method that is expected to return a list of all table names for a given database handler of DBI.

Hence, implementations are expected to follow this pattern:

   package TBD::DBI::MyRelationalDatabase;
   use DBI;
   use TBD::DBI;
   use strict;
   use warnings;
   our @ISA = qw(TBD::DBI);
   sub tables {
      my ($package, $db) = @_;
      # extract all table names of $db
      return @tables;
   }
   sub initialize1 {
      my ($self) = @_;
      # set $self->{keyfields}
      $self->SUPER::initialize2();
   }

Following components of the table objects may be used by initialize1 or initialize2 by a derived module:

db

database handler of DBI.

table

is the name of the database table. While this is in most cases identical to the table name it could be different.


AUTHOR

Andreas Borchert