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: "Scott Zetlan" <scottzetlan at aol dot com>
Subject: Re: Sybase::CTlib implementation of BLK routines and NUMERIC() values
Date: May 18 2004 1:01PM

Michael Peppler wrote on 5/18/2004, 8:42 AM:
> This leads me to think that the new behavior is the right one - if the 
> data getting loaded doesn't fit the row shouldn't be allowed to go 
> through. 
> 
> I'd like to hear from those of you that use the blk_xxx() API to see 
> what the consensus on this issue is. 

I think Sybase is wrong on this one.  The default behavior should be to load the data and produce a warning.  Sybase::CTlib's implementation (and thus Sybase::BLK's) should use that as it's default position, and should provide an option to either suppress that warning or escalate it to a failure.

There are numerous other instances where Sybase automatically attempts to convert datatypes during bulk load: strings to dates, numeric to float, etc.  In those cases, there's only a failure if the conversion fails, and the conversion can succeed despite a potential loss of range or precision.  Why should numeric data types be any different?  The only change I would see making from the previous behavior would be to round, rather than truncate, the number in question.  Thus 123.456 when loaded into a numeric (6, 2) would become 123.46.

In any case, Sybase::CTlib and Sybase::BLK should be flexible on this point and allow the programmer to override Sybase's default behavior as needed.