Re: [PATCH] to improve DBD::Sybase 'make test' when using freetds
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
2010/4/11 David Dick <[email protected]>: > 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. > Well... patch left after some commits 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 So default english... 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; not tested.... documentation does not state anything on the subject.... 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) this is quite strange and should cause a syntax error (conversion fail) if a NUL character is found in the string.... Am I right ? I though this was handled and tested by some of our tests but according to coverage (http://freetds.sourceforge.net/up/out83/coverage/tds/convert.c.gcov.html) it isn't.... I would check other libraries... or perhaps we could "fix" only CTLib. freddy77 _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds