freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds
- From: David Dick <ddick AT cpan.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds
- Date: Sun, 11 Apr 2010 20:33:28 +1000
This patch redirects some logging statements from stderr to the tdsdump file and tries to improve the results of running 'make test' from DBD::Sybase when using the freetds libraries. It allows every DBD::Sybase test to pass except for t/xblob.t.
diff -Naur old/locales.conf new/locales.conf
--- old/locales.conf 2008-02-29 09:30:19.000000000 +1100
+++ new/locales.conf 2010-04-11 20:22:08.000000000 +1000
@@ -1,5 +1,5 @@
[default]
- date format = %b %e %Y %I:%M:%S:%z%p
+ date format = %b %e %Y %I:%M
[en_US]
date format = %b %e %Y %I:%M:%S:%z%p
diff -Naur old/src/ctlib/cs.c new/src/ctlib/cs.c
--- old/src/ctlib/cs.c 2007-12-24 08:12:02.000000000 +1100
+++ new/src/ctlib/cs.c 2010-04-11 20:22:08.000000000 +1000
@@ -471,7 +471,14 @@
src_type, src_len, desttype, destlen);
if (!is_fixed_type(desttype) && (destlen <= 0)) {
- return CS_FAIL;
+ destlen = srcfmt ? srcfmt->maxlength : 0;
+ if (destlen <= 0) {
+ tdsdump_log(TDS_DBG_FUNC, "cs_convert() could not
determine the maxlength for the destination field\n");
+ return CS_FAIL;
+ }
+ }
+ if ((is_numeric_type(src_type)) && (desttype == SYBCHAR)) {
+ destlen += 1; /* maxlength does not take into account the
decimal point in the resulting string */
}
dest = (unsigned char *) destdata;
@@ -668,7 +675,7 @@
if (len > destlen) {
free(cres.ib);
- fprintf(stderr, "error_handler: Data-conversion
resulted in overflow.\n");
+ tdsdump_log(TDS_DBG_FUNC, "error_handler:
Data-conversion resulted in overflow\n");
ret = CS_FAIL;
} else {
memcpy(dest, cres.ib, len);
@@ -757,7 +764,10 @@
case SYBVARCHAR:
case SYBTEXT:
if (len > destlen) {
- fprintf(stderr, "error_handler: Data-conversion
resulted in overflow.\n");
+ tdsdump_log(TDS_DBG_FUNC, "Data-conversion resulted
in overflow\n");
+ len = destlen;
+ }
+ if (len > destlen) {
ret = CS_FAIL;
} else {
switch (destfmt->format) {
diff -Naur old/src/ctlib/ct.c new/src/ctlib/ct.c
--- old/src/ctlib/ct.c 2008-05-06 13:23:45.000000000 +1000
+++ new/src/ctlib/ct.c 2010-04-11 20:22:08.000000000 +1000
@@ -2335,6 +2335,14 @@
datafmt->status |= CS_CANBENULL;
if (curcol->column_identity)
datafmt->status |= CS_IDENTITY;
+ if (curcol->column_writeable)
+ datafmt->status |= CS_UPDATABLE;
+ if (curcol->column_key)
+ datafmt->status |= CS_KEY;
+ if (curcol->column_hidden)
+ datafmt->status |= CS_HIDDEN;
+ if (curcol->column_timestamp)
+ datafmt->status |= CS_TIMESTAMP;
if (strcmp(datafmt->name, "txts") == 0)
datafmt->status |= CS_TIMESTAMP;
diff -Naur old/src/tds/convert.c new/src/tds/convert.c
--- old/src/tds/convert.c 2008-02-04 18:55:39.000000000 +1100
+++ new/src/tds/convert.c 2010-04-11 20:22:08.000000000 +1000
@@ -2070,6 +2070,7 @@
old_digits_left = digits_left;
digits_left = cr->n.scale;
places = 1;
+ } else if (*pstr == 0) {
} else if (*pstr == ' ') {
for (; pstr != pend && *pstr == ' '; ++pstr) ; /*
skip contiguous blanks */
if (pstr == pend)
-
[freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds,
David Dick, 04/11/2010
-
Re: [freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds,
Frediano Ziglio, 04/13/2010
-
Re: [freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds,
David Dick, 04/18/2010
- Re: [freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds, Frediano Ziglio, 04/26/2010
-
Re: [freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds,
David Dick, 04/18/2010
-
Re: [freetds] [PATCH] to improve DBD::Sybase 'make test' when using freetds,
Frediano Ziglio, 04/13/2010
Archive powered by MHonArc 2.6.24.