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: "Eric Deutsch" <edeutsch AT systemsbiology.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: RE: Losing last character of TEXT fields
  • Date: Tue, 9 Jul 2002 13:31:11 -0700



Okay, well, I'm all for keeping it this way then.

I've found the first test case where the old [cplen-1] would have
worked, but I don't think we should change it. It occurs with ODBC and
it appears that when SELECTing TEXT under DBD::ODBC, srclen is one too
large. I don't know why that is, but since tds_convert_text() is being
lied to about how long src[] is, it shouldn't be at fault.

Anyway, I'd vote for checking this in as is and seeing what happens.

What do you mean, funny? ;-)



> -----Original Message-----
> From: Lowden, James K [mailto:LowdenJK AT bernstein.com]
> Sent: Tuesday, July 09, 2002 12:56 PM
> To: TDS Development Group
> Subject: [freetds] RE: Losing last character of TEXT fields
>
> > 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
>
> ---
> You are currently subscribed to freetds as:
[edeutsch AT systemsbiology.org]
> To unsubscribe, forward this message to leave-freetds-
> 127899P AT franklin.oit.unc.edu




Archive powered by MHonArc 2.6.24.

Top of Page