QUICK DESCRIPTION
Bulk copies data into a Sybase table. Data sources can include a)
another Sybase table, b) the results of any Transact-Sql, c) the
return values from a perl subroutine called repetitively, or d) a flat
file. An attempt is made to make error reporting/handling/intercepting
more accessible. One option worth noting here is -auto_delete. It
instructs the module to only delete the rows you're about to insert.
Also comes with a command line wrapper, sybxfer.
INSTALLATION (the usual)
perl Makefile.PL [ LIB=<alternate installation> ]
make
make test
make install
DEPENDENCIES
Requires Perl Version 5.005 or beyond
Requires packages:
Sybase::DBlib
SYNOPSIS
#from perl
#!/usr/bin/perl5.005
use Sybase::Xfer;
$h = new Sybase::Xfer( %options );
$h->xfer();
$h->done();
#from shell
#!/usr/ksh
sybxfer <options>
CONTACTS
my e-mail:
[email protected]
CHANGE LOG:
------------------------
Version .40 01-mar-2001
------------------------
* new defaults
-U and -P default to $ENV{USER}, -S defaults to $ENV{DSQUERY}
* more concise usage
-help will invoke a short help, '-help more' will invoke a
slightly more expanded help
* list return context for method xfer
if method xfer called in list context it will return
(num_rows_read, num_rows_transferred, last_error_detected)
# new switch -from_file_map (-ffm)
allows re-arranging of fields in -from_file to columns
in -to_table
* float/int syntax error focus
the smart error reporting expanded to include float and
int checks when sybase just indicates a "syntax error".
* the module no longer exits anywhere
Where it exited before it now returns with a unsuccessful
return code.
* tweaked the output of -progress_log a little.
------------------------
Version .31 12-feb-2001
------------------------
* Fixed sloppy bug left in v.30 where if @ARGV is empty it'd print a
usage statment. Duh! That holds for the script sybxfer but it
doesn't hold user written scripts.
------------------------
Version .30 11-feb-2001
------------------------
Some promised mods.
* New/modified switches as follows:
-error_handling 'continue|abort|retry'
added value 'retry'. Will behave like Sybase::BCP upon error
on bcp_batch. In other words, set the batchsize to 1 and
resend the data. Prints failed records to -error_data_file.
(thanks to Michael Peppler for allowing me to raid his code.)
-retry_max 'n'
number of times to retry a failed bcp_batch. Default is
three.
-retry_deadlock_sleep 'sec'
number of seconds to sleep between sending the bcp_batch
again iff a deadlock error is detected. Default is 120.
-callback_err_batch 'coderef'
implemented it. Now users can modify the rows in the batch
and request that xfer resend it or not. Default is Xfer's own
routine that implements the most useful behaviour
(hopefully.)
-error_data_file | -edf <filename>
contains records that failed to transfer in addition to
source record number and Sybase erorr message for each record
that failed.
-from_file | -ff <filename>
new source. Take the data from a flat file. Must be a
delimited file. Steals a chapter from Sybase's bcp.
-from_file_delimiter | -ffd <regex for delimiter>
used inconjunction with with -from_file. The delimeter can be
regular expression. (similiar to -t switch in Sybase's bcp)
-holdlock
if switch -from_table specified then this switch appends a
'holdlock' to internally generated select statement.
-app_name <name>
sets the program_name in master..sysprocesses table. Defaults
to the script name.
-delete_flag
modified such that rows are deleted in -batchsize increments
so the log doesn't get blown.
* changed the final summary message slightly to report:
1) num rows read from source
2) num rows resent to target table (only if errors)
3) num rows failed to be transferred
* if no args given it'll exit gracefully with a message to run perldoc