Dear Perl Coders,
I would like to publish a module on CPAN (author ID: JDS) and would like to
make sure it gets an appropriate name. In "About PAUSE" I read that I should
write to your mailing list to get advice on this important issue.
Despite an extensive search I have not found anything similar on CPAN or a
module where the functionality would naturally fit in. The only (weakly
related) module I could find is DBIx::CopyRecord.
My current favourite name is DBIx::Table::Inflate and here is what it does
when I am done coding it, right now there is only a (released/mature) Oracle
PL/SQL procedure. I intend to support a wide range of DBMSs besides Oracle:
The module exposes only one method inflate() which can be used to add records
to a table, mainly with performance tests of database clients in mind.
inflate() automatically takes into account the different types of constraints
on the target table and tries to generate meaningful records by using values
coming from the target table itself or from referenced tables. A sample usage
(subject to changes) looks like this:
use DBIx::Table::Inflate;
my $inflation = DBIx::Table::Inflate->new();
$inflation->inflate({
dbh =>$dbh,
table_name => $table,
target_size => $size,
num_random => $random,
max_tree_depth => $depth,
min_children => $min_children,
min_roots => $min_roots
});
The parameters are as follows:
dbh: DBI database handle
table_name: name of the table to inflated
target_size: total number of records to be reached
num_random: The first num_random number of records use fresh random choices for
their values taken from foreign key relations or from the target table itself.
For performance reasons, these values are stored in a cache and re-used for the
remaining target_size - num_random records.
(the last three parameters become relevant only in case of self-references of
the target table (current definition of a self-ref: one-column wide foreign key
constraint to itself):
max_tree_depth: maximum depth at which new records will be inserted
min_children: minimum number of child records to be inserted (currently using a
breadth-first traversal)
min_roots: the minimum number of root elements defined after completion. A
record is considered to be a root element if the corresponding parent id is
null or equal to its child id
Thank you & kind regards
José Diaz Seng