Skip to Content.
Sympa Menu

freetds - Re: [freetds] SYBLONGBINARY mapping to CS_CHAR_TYPE in src/ctlib/ct.c

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SYBLONGBINARY mapping to CS_CHAR_TYPE in src/ctlib/ct.c
  • Date: Sun, 13 Dec 2009 10:49:03 +0100

Il giorno gio, 10/12/2009 alle 15.19 +0100, Christian Hoffmann ha
scritto:
> Hi all,
>
> I am facing a problem with freetds when calling a stored procedure
> that returns a SYBLONGBINARY (column in table is of type "varbinary
> (2000)"). It looks like the code in _ct_get_client_type (int, int,
> int) function returns a CS_CHAR_TYPE and not as I would expect a
> CS_LONGBINARY_TYPE. I tried to look in the CVS history and at
> somepoint it was changed from CS_BINARY_TYPE to CS_CHAR_TYPE:
>
> http://freetds.cvs.sourceforge.net/viewvc/freetds/freetds/src/ctlib/ct.c?r1=1.108&r2=1.109
>
> Any idea why this is done like this?
>
> Kind regards,
>
> Chris
>
> PS: I would have thought to change the code to this:
>
> Index: src/ctlib/ct.c
> ===================================================================
> --- src/ctlib/ct.c (revision 89641)
> +++ src/ctlib/ct.c (working copy)
> @@ -1991,7 +1991,7 @@
> case SYBLONGBINARY:
> if (usertype == USER_UNICHAR_TYPE || usertype ==
> USER_UNIVARCHAR_TYPE)
> return CS_UNICHAR_TYPE;
> - return CS_CHAR_TYPE;
> + return CS_LONGBINARY_TYPE;
> break;
> }

>From commit

Sun Nov 30 13:00:17 CET 2003 Frediano Ziglio <freddy77 AT angelfire.com>
* include/cspublic.h include/tds.h src/ctlib/cs.c:
* src/ctlib/ct.c src/tds/convert.c src/tds/token.c:
- applied Alex Kiesel patch on UNI(VAR)CHAR

So I applied the patch. This patch is supposed to fix some problems with
UNI(VAR)CHAR. UNI(VAR)CHAR are encoded with SYBLONGBINARY with specific
usertypes. I however agree that for no-char should be CS_BINARY_TYPE.
Probably there is no test for this behavior on our unittests.

Applied!

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page