freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- 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
-
RE: Losing last character of TEXT fields
, (continued)
- RE: Losing last character of TEXT fields, James K. Lowden, 07/08/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/09/2002
- RE: Losing last character of TEXT fields, Bill Thompson, 07/09/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/09/2002
- RE: Losing last character of TEXT fields, Bill Thompson, 07/09/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/09/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/09/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/09/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Michael Peppler, 07/09/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/09/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/09/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/09/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/10/2002
- RE: Losing last character of TEXT fields, Bill Thompson, 07/10/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/10/2002
- RE: Losing last character of TEXT fields, Thompson, Bill D (London), 07/10/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/10/2002
Archive powered by MHonArc 2.6.24.