[freetds] [PATCH] Problem with VARCHAR in sybase.
epronk at muftor.com
Sat Jul 5 19:08:52 EDT 2008
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:
_type = DBI_TYPE_STRING;
datafmt->format = CS_FMT_NULLTERM;
++datafmt->maxlength; /* 1 extra byte for \0 */
Increase the maxlength with 1 byte before calling bind.
> 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.
More information about the FreeTDS