freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Bill Thompson" <thompbil AT exchange.uk.ml.com>
- To: freetds AT franklin.oit.unc.edu
- Subject: Re: Convert patches...
- Date: Fri, 2 Aug 2002 08:16:48 -0400
Freddy,
>
> Yes, like-to-like is now a cut and paste between ctlib and dblib
>
Not quite, but point taken...
>
> Well, I'll explain my idea on char a bit deeper.
> tds_convert should return chars of string bounding to destlen without
> terminating or padding in any case.
> If we convert "test" to char(2) it should return (on the buffer) just "te"
> (or best, in C { 't', 'e' }, not terminating).
> If we have dblib with destlen -1 we call tds_convert with destlen = 2G.
> tds_convert copy only the bytes of the string (and return length copied).
> Also tds_convert should return length of full string.
> If we convert string "quite long string" to a char(7) we return "quite l"
> (not terminated) and a length of 17. ODBC for example can terminate with
> "quite ", return full length and success while ctlib can return failure...
>
Yes, but the different API's handle things differently. Sybase dblib and
ctlib for instance return an error if the destination variable is too
small to handle the returned data (and do not affect the host variable in
any way), whereas odbc truncates the data as in your suggestion. I've
tried to accurately reproduce the behaviours of the various API's , and I
reckoned that unless tds_convert knew which API was calling it, it could
not make the correct decisions...
>
> Problem is not free, is malloc.
> From convert.c:
> cr->c = malloc(srclen + 1);
> memset(cr->c, '\0', srclen + 1);
> If malloc return NULL the program core dump...
Fair comment, I'll amend code accordingly...
Bill
-
Convert patches...,
ZIGLIO Frediano, 08/02/2002
- <Possible follow-up(s)>
- Re: Convert patches..., Bill Thompson, 08/02/2002
- Re: Convert patches..., ZIGLIO Frediano, 08/02/2002
- Re: Convert patches..., Bill Thompson, 08/02/2002
- Re: Convert patches..., ZIGLIO Frediano, 08/02/2002
- Re: Convert patches..., Bill Thompson, 08/02/2002
- Re: Convert patches..., ZIGLIO Frediano, 08/02/2002
- Re: Convert patches..., Frediano Ziglio, 08/02/2002
Archive powered by MHonArc 2.6.24.