astaines has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am writing a module which wraps the table_info() function in DBI. Clearly it need a working database handle to operate on. I want to write some test scripts for it. These work fine on my system, where I can feed them a working databse handle easily.
How should I provide tests for other people to use, assuming that anyone else is ever mad enough to use this module? I may be missing something fundamental here, but all advice is gratefully accepted.(Any comments on the basic idea of this module, and whether there's a better solution also welcome)
Anthony Staines
^^^^^^^^^^^^^^^
SYNOPSIS use DBIx::Information; 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 th +e variables in each table # Index keyed by variable name to anonymous arrays of the na +mes 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 s +ingle database, or (possibly) a singe schema. I only have Mysql, and it +*will* work with this. If you have other databases fell free to test... EXPORT Nothing. don't even try. AUTHOR Anthony.Staines@ucd.ie SEE ALSO the perl manpage.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Writing tests for modules using database handles
by chromatic (Archbishop) on Aug 02, 2001 at 04:48 UTC | |
Re: Writing tests for modules using database handles
by bikeNomad (Priest) on Aug 02, 2001 at 04:45 UTC |