freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] tds/convert.c
- Date: Thu, 18 Dec 2003 11:10:05 +0100
>
> Looking at the two functions in convert.c -
> tds_convert_char() and tds_convert_binary(), it looks to me
> (and experiment seems to confirm this) that the code that
> does conversion of SYBBINARY fields in tds_convert_char
> should be swapped with the code that handles SYBTEXT fields
> that is in tds_convert_binary.
>
> In more detail: in tds_convert_char which converts text or
> character data fields from the database to a different sort,
> when it want to convert to a SYBBINARY, SYBIMAGE and
> SYBVARBINARY field, it should not be looking in the source
> buffer for 0x... something hex strings, but should be
> creating such a string. And similarly in tds_convert_binary
> which changes a binary (hex string) to something else, the
> SYBCHAR, SYBVARCHAR and SYBTEXT handling is trying to turn
> the hex binary string into another hex binary string instead
> of decoding it. I noticed this because of an error
> "error_handler: attempt to convert data stopped by syntax
> error in source field" being displayed. Thus the two bits of
> code need swapping. Someone else may have already reported
> this, I didn't read through all of the archives to check.
>
Issuing this sql code:
select convert(varbinary, convert(varchar,'414141'))
select convert(varchar, convert(varbinary, 0x414141))
Procuce this output
--------------------------------------------------------------
0x343134313431
(1 row(s) affected)
------------------------------
AAA
(1 row(s) affected)
As you can see varchar -> varbinary conversion reflect FreeTDS
behaviour.
varbinary -> varchar seems wrong however this a library behaviour and
has been well tested.
How did you test FreeTDS?
freddy77
-
[freetds] tds/convert.c,
Simon Young, 12/18/2003
- <Possible follow-up(s)>
- RE: [freetds] tds/convert.c, ZIGLIO Frediano, 12/18/2003
Archive powered by MHonArc 2.6.24.