The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

 DBIx::CopyRecord - copy record(s) while maintaining referential integrity within a database.

DESCRIPTION

 This module can copy record(s) while maintaining referential integrity within a database.  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).  

 You can define all of the relationships in the arguments to 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).