|
|
sybperl-l Archive
Up Prev Next
From: cenvnc <cenvnc at gmail dot com>
Subject: Error handling in Sybase::BCP
Date: Aug 14 2006 9:42AM
Hello,
I've just discovered this list after hours of pulling my hair out!
I have written a perl script using sybase::bcp. All the script does is
input 8000+ lines of data to a database. In the database we have an
index that does not allow duplicate lines. If a duplicate line is
detected sybase:bcp throws a database error. I need to catch and process
this error.
I used the Error.pm perl module to catch the error. It allows 'try',
'catch' syntax (I prefer it ;) )
Now the problem i'm having is that the errors thrown by the sysbase::bcp
module are not caught by try and catch. I cant even redirect the output
into a file, since (correct me if im wrong) the database errors are not
on the std out.
here's an example:
try
{
my $bcp = new Sybase::BCP $USER, $PWD, $SERVER;
$bcp->config(INPUT => "/data/$FILEOUT",
OUTPUT => "$DATABASE.dbo.$FILE_TABLE",
SEPARATOR => ',',
ERRORS => "$ERRORLOCATION/$FILEOUT.err");
}
catch Error with
{
#do general error processing
#print error code
#print error_msg
}
Please can some one point me to some docs that explains the exception
handling in SYBASE::BCP. Or better yet, some example code - code is
worth more than a thousand words :)
I need to know *how to catch errors* for the module. The above obviously
does not work...any suggestions?
|