NAME
DBIx::CopyRecord - copying record sets within a database while maintaining referential integrity.
DESCRIPTION
This module can copy record(s) in a database whild maintaining referential
integrity. The C<copy> method is all that's needed. It's useful for copying
related record(s) and assigning a new key value to the new record(s). All
while maintaining referential integrity.
You can specify all of the relationships in the copy command, for example, if your DB is not using foreign keys. Or, simply tell the method what the name of the foreign key is and the module will do the rest.
The copy method will return the assigned key value so that you can use it.
USAGE
use DBIx::CopyRecord;
my $CR = DBIx::CopyRecord->new( DB HANDLE );
RV = $CR->copy(
{ table_name => TABLE NAME,
primary_key => PRIMARY KEY COLUMN,
primary_key_value => VALUE, NULL or SELECT,
where => WHERE CONDITION,
override => {
billed = 'N',
invoice_date = 'NULL'
}
child => [ { table_name => CHILD TABLE NAME,
primary_key => CHILD PRIMARY KEY COLUMN,
primary_key_value => CHILD VALUE, NULL or SELECT,
foreign_key => COLUMN NAME OF },
{ table_name => CHILD TABLE NAME } ] });
Child table_name entry without additional arguments will attempt to figure out the primary key and foreign key from the database.
AUTHOR
Jack Bilemjian <jck000@gmail.com>
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
DBI(1).