Skip to Content.
Sympa Menu

freetds - RE: Losing last character of TEXT fields

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: Losing last character of TEXT fields
  • Date: Tue, 9 Jul 2002 12:52:04 -0400


> > We shouldn't null-terminate unless destlen is -1. If the
> destination buffer
> > is too small, we should call the error handler and return
> -1. So say the docs. Eric?

> From: Brian Bruns [mailto:camber AT ais.org]
> Sent: July 9, 2002 11:47 AM
>
> It think the root cause may be deeper. Why is a short
> destlen being asked
> for? This may have something to do with the return value of
> dbdatlen() or
> similar calls... ie the application code may be:
>
> mylen = dbdatlen(dbproc, colnum);
> mybuf = malloc(mylen);
> dbconvert(dbproc,..., mybuf, mylen);
>
> So by fixing dbdatlen() or whichever it turns out to be, we may get an
> extra char *and* no buffer problem.

I see your point. I was thinking more of user conversions, via dbconvert()
or whatever. This should work, and doesn't:

int i = 1;
char c;
erc = dbconvert (dbproc, SYBINT4, &i, 0, SYBCHAR, &c, 1);

But there may well be a deeper issue within tdslib.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page