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 15:55:58 -0400


> From: Eric Deutsch [mailto:edeutsch AT systemsbiology.org]
> Sent: July 9, 2002 1:43 PM
>
> case SYBTEXT:
> case SYBCHAR:
> case SYBBINARY:
> cplen = srclen > destlen ? destlen : srclen;
> memcpy(dest, src, cplen);
> return cplen;

Eric,

Your remarks are on the money. Please ignore my last message. I now like
your "radical" solution best, because it's both simple and funny.

I should have looked at cs.c, at cs_convert(). I was fixing dblib in
tdslib, with the consequence of breaking ctlib. The weird termination
behavior described in the dblib docs shouldn't be embedded in a shared
library. dbconvert() is what needs attention.

Brian, I'd like to suggest a policy about conversions for the project; if
you like it then it should be explicitly noted somewhere.

<policy>
tds_convert copies from src to dest and returns the output data length,
period. All padding and termination is the responsibilty of the API library
and is done post conversion. There may be some shared utility padding &
termination functions, but they're really not "conversion". Trying to do
anything nonstraightforward in tds_convert will only confuse and confound
the higher levels, us among them.
</policy>

An alternative would be to pass the padding & termination policy argument as
an enumerated type, which tds_convert would carry out if the basic
conversion succeeds.

You have more experience with this (obviously), and have some idea where
UTF-8 is taking us, so I'm curious how you see things.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page