DBIx::XML::DataLoader::DB
use DBIx::XML::DataLoader::DB; my $db=DB->new(dbmode=>"insertupdate", dbprint=>"dbprint"); my $dbh=$db->DBConnect($DBLOG, $DBPASS, $DATA_SOURCE); my ($response, $error,$load)=$db->DBInsertUpdate( datainfo=>\@inserts_data, dbconnections=>$db_connections );
This module is hard coded for use with oracle. To change this setting edit the line use DBI::Oracle to reflect your database choice
This module is used primarily inside DataLoader.pm. It is also used in the sample script query_cb.pl
DBInsertUpdate needs passed to a hash containing a arrayref to a array of hashes containing the data that will be worked with, and dbconnections a hashref to a hash of dbconnections keyed by handle names. The hashes contained in the array of data should have the folowing keys cols: a array of the columns that are in this table table: the name of the table for this data keys: the key columns in the table results: a array of row hashes containing the data for each cell in the a table row. The hashes are keyed by column name. dbname: the name of the db handle that will be used. The hash containing the dbconnections contains blessed db connection objects keyed by handle names. The items returned by the module are message, errors, and load(if dbmode=>"sqlloader");
These are the options you can pass to DB.pm dbmode: Options are insertupdate: attempts to do a update and if that fails, a insert is done insert: attempts to do a insert only update: attempts to do a update only sqlloader: passes back a extra varibale that will contain data suitable for writing to a file for use with sqlloader default is insertupdate dbprint: Options are db: tells the module to do the selected dbmode print: simulate doing the dbmode, and add to $response the statements that would have been passed to the database dbandprint: do both the operations above. default is db
To install DBIx::XML::DataLoader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::XML::DataLoader
CPAN shell
perl -MCPAN -e shell install DBIx::XML::DataLoader
For more information on module installation, please visit the detailed CPAN module installation guide.