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: David Dick <ddick at cpan dot org>
Subject: [PATCH] improve "make test" results when running against freetds
Date: Apr 18 2010 11:14PM

diff -Naur old/dbdimp.c new/dbdimp.c
--- old/dbdimp.c	2010-04-10 22:05:36.000000000 +1000
+++ new/dbdimp.c	2010-04-19 08:09:01.000000000 +1000
@@ -4777,6 +4777,7 @@
 	srcfmt.maxlength = strlen(str);
 	srcfmt.format = CS_FMT_NULLTERM;
 	srcfmt.locale = locale;
+	datafmt->maxlength = strlen(str);
 
 	if (type) { /* RPC call */
 		if ((p = strchr(str, '.')))
@@ -4791,10 +4792,14 @@
 		if ((p = strchr(str, '.'))) {
 			int len = strlen(++p);
 			if (len > datafmt->scale) {
-				if (p[datafmt->scale] < '5')
+				if (p[datafmt->scale] < '5') {
 					p[datafmt->scale] = 0;
-				else {
+					srcfmt.maxlength = srcfmt.maxlength - 1;
+					datafmt->maxlength = datafmt->maxlength - 1;
+				} else {
 					p[datafmt->scale] = 0;
+					srcfmt.maxlength = srcfmt.maxlength - 1;
+					datafmt->maxlength = datafmt->maxlength - 1;
 					len = strlen(str);
 					while (len--) {
 						if (str[len] == '.')
@@ -4804,6 +4809,8 @@
 							break;
 						}
 						str[len] = '0';
+						srcfmt.maxlength = srcfmt.maxlength - 1;
+						datafmt->maxlength = datafmt->maxlength - 1;
 						if (len == 0) {
 							char buf[64];
 							buf[0] = '1';