PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Peter Sinnott <psinnottie at aol dot com>
Subject: bcp via Sybase::DBlib - seg faults and error catching
Date: Sep 11 2002 3:22PM

Hi,
	I am currently in the process of writing a script that uses
Sybase::DBlib to bcp some data. Everything seems to be going fine
when I give it nice data but I have some questions about error handling.


When I call bcp_sendrow with an oversized field ( sending 20 chars to a
char(10) ) $DB_ERROR gets set but FAILURE is not returned. Is there any
way to upgrade this warning to an error or to role back the sendrow?


Prior to fetching the data I call bcp_meminit with the number of columns
I expect(say 3). If I call bcp_sendrow with an array ref with 5 elements the
script bombs out with : 

More columns passed to bcp_sendrow than were allocated with bcp_meminit
at /VBB/BCP.pm line 226,  line 3

With 4 the sendrow goes ok and the first 3 elements get inserted. I can't
see any indication anything has gone wrong but when I call bcp_done I
get a seg fault. The data( minus the extra column) get commited to the table.
This seems to be kinda messed up,is this a bug or just me being silly?
This is with perl 5.6.1 and sybperl-2.14.

Finally,when I call bcp_batch and it bombs because I'm inserting a
duplicate row in a table with a unique index is there any simple way to
work out which row is causing the problem? There will probably be
situations where I want an all or nothing bcp so I can't use a batch
size of one to work out the problem row. Whenever the angry men with
beepers get called I'm sure they would like to know which row is causing
the problem.


Many thanks for your time
Peter

-- 
We exist to enthusiastically create resource-leveling technology because 
that is what the customer expects