|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: sybperl 2.17 build issues (and DBD::Sybase 1.04.x issues)
Date: Aug 3 2004 2:28PM
On Fri, 2004-07-30 at 09:35, Michael Peppler wrote:
> I think the issues with sybperl 2.17 tests failing/core dumping (and
> similar problems with the test DBD::Sybase 1.04.x releases) has to do
> with the BLK code.
I think I've found the problem.
Here's what I've done:
Default handling is to FAIL all data conversion errors (truncation and
overflow) except for string truncation due to CHAR column overflow.
You can override this behavior by defining a new type of error handler,
which will be called from the conversion routine. If the error handler
returns CS_SUCCEED then the Sybase::CTlib module ignores the conversion
error and attempts to send the data to the server anyway.
For example (from t/2_ct_xblk.t)
sub msg_cb {
my ($layer, $origin, $severity, $number, $msg, $osmsg, $usermsg) = @_;
print "$layer $origin $severity $number: $msg ($usermsg)\n";
if($number == 36) {
return CS_SUCCEED;
}
return CS_FAIL;
}
ct_callback(CS_MESSAGE_CB, \&msg_cb); # Note CS_MESSAGE_CB!
Now, if we try to convert 123.456 to a NUMERIC(6,2) we'll get an error
number of "36" and the following message:
cs_convert: cslib user api layer: common library error: The
result is truncated because the conversion/operation resulted in
overflow.
and the resulting value being inserted will be 123.45 (note truncation,
not rounding!).
If we try to convert 'Feb 29 2001' to a DATETIME, we'll get an error
code of "20" and:
cs_convert: cslib user api layer: common library error: The
conversion/operation resulted in overflow.
In this case the conversion fails completely.
This code is in test release 2.171, which is now available at
http://www.peppler.org/downloads/sybperl-2.171.tar.gz
I'd appreciate it if those of you who had problems building/testing 2.17
could take this version for a spin.
If this works out correctly then I'll port this code over to DBD::Sybase
as well.
Thanks!
Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler@peppler.org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html
|