Hi,
      I've written a module for my own use which provides a
convenient wrapper for the table_info() function in DBI.
I use it in some web front ends to (small!) data warehouses
which I'm writing here.

Two questions - Is there a better solution out there?
                     I have looked...

                 If there isn't, is the name any good?
                   (suggestions gratefully received).

Note that this is presently Version 0.05 or therabouts. If you want it
anyway, e-mail me. Is it worth putting this up on CPAN when it works 
more reliably, or is this just too simple minded for words....

It does the following :-

SYNOPSIS
       use DBIx::Information;  ## Note :- I will choose a name acceptable
                                 to you all before sending it anywhere
       my $dbinf->new($dbh);

       # Get a list of tables in the database
       my @tables = @{ $dbinf->tables()};

       # Get a list of variables in the whole database
       my @variables = @{ $dbinf->variables()};

       # Get a list of the variable in the table called $table_name;
       my @myvariable = @{ $dbinf->variable($table_name)};

       # Get two useful hashes-
       #     List keyed by table to anonymous arrays
       #       of the names of the variables in each table
       #     Index keyed by variable name to anonymous arrays
       #        of the names of the table
       #     (or tables) in which each variable occurs.
       #
       my %list  = %{$dbinf->list()};
       my %index = %{$dbinf->index()};

       #Does the variable exist in the specified table?

       my $exists = $dbinf->IsVarinTable($variable_name,$table_name);

DESCRIPTION
     This module provides a convenient interface to the contents
     of a single database, or (possibly) a single schema. I only
     have Mysql, and it *does* work with this. If you have other
     databases fell free to test...

   EXPORT

     Nothing. don't even try.

AUTHOR
     [EMAIL PROTECTED]

SEE ALSO
     the perl manpage.

   TO DO
             # Get the return list, table, variables etc.. ,
               to detect their calling context with wantarray()
               and do the right thing(TM)..
-- 
Anthony Staines, Lecturer in Epidemiology, Department of Public Health,
   UCD, Earlsfort Terrace, Dublin2, Ireland.
   E-mail :- [EMAIL PROTECTED] Web :-http://astaines2.ucd.ie/
     Work :- + 353 1 716 7345       Fax :- +353 1 716 7407
     Home :- + 353 1 849 1089    Mobile :- +353 1 86 606 9713   

Reply via email to