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: Michael Peppler <mpeppler AT peppler.org>
  • To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: Losing last character of TEXT fields
  • Date: 09 Jul 2002 11:10:30 -0700

On Tue, 2002-07-09 at 10:42, Eric Deutsch wrote:

>
> Errr.. I think you may be right. I changed my code to now read:
>
> case SYBTEXT:
> case SYBCHAR:
> cplen = srclen > destlen ? destlen : srclen;
> memcpy(dest, src, cplen);
> return cplen;
> case SYBBINARY:
> cplen = srclen > destlen ? destlen : srclen;
> memcpy(dest, src, cplen);
> return cplen;
>
> and it seems to work fine. So perhaps the real question is, why were we
> ever fooling around with \0 termination in the first place?

I don't follow FreeTDS closely, so I may be off-base here, but:

If this conversion routine is shared between DBlib and CTlib then you
need to support optional null-termination. When using CTlib's ct_bind()
or ct_convert() you have the option of setting the "format" field of the
CS_DATAFMT struct to CS_FMT_NULLTERM, CS_FMT_UNUSED or CS_FMT_PADBLANK
to get different termination behavior.

I forget at the moment if DBlib has the same or similar functionality.

Michael
--
Michael Peppler / mpeppler AT peppler.org / http://www.mbay.net/~mpeppler
mpeppler AT zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!

Attachment: signature.asc
Description: This is a digitally signed message part




Archive powered by MHonArc 2.6.24.

Top of Page