Skip to Content.
Sympa Menu

freetds - Re: [freetds] [PATCH] Problem with VARCHAR in sybase.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Eddy Pronk <epronk AT muftor.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [PATCH] Problem with VARCHAR in sybase.
  • Date: Sun, 06 Jul 2008 09:08:52 +1000

James K. Lowden wrote:

The basic question is: How should ct_fetch() react when the
datafmt.maxlength argument indicates a length *exactly* equal to the
length of the returned data and datafmt.format is CS_FMT_NULLTERM?
The way I solved it for now inside libdbi right now is like this:

case CS_CHAR_TYPE:
case CS_TEXT_TYPE:
case CS_VARCHAR_TYPE:
_type = DBI_TYPE_STRING;
datafmt->format = CS_FMT_NULLTERM;
++datafmt->maxlength; /* 1 extra byte for \0 */
break;

Increase the maxlength with 1 byte before calling bind.
see: *http://thread.gmane.org/gmane.comp.db.libdbi.drivers/225*

ct_fetch() copies 16 bytes, discovers there's no room for the NULL
terminator, and returns the error. Exactly as should be.
I'm interested to hear if CVS HEAD resolves the original problem.
I'll try it with CVS HEAD.

Eddy




Archive powered by MHonArc 2.6.24.

Top of Page