Re: CTLib patch

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
2009/6/17 Andrew Victor <[email protected]>
>
> hi Frediano,
>
> > ... it seems that client datatype does not support
> > wide characters, isn't it? So you are correctly trying to bind client
> > utf-8 (multi-byte) to server wide characters (nvarchar in mssql),
> > isn't it?
>
> There must be some data-type mapping to NVARCHAR?  I assumed it was
> CS_UNICHAR_TYPE.
>

Well... I think you should be able to map even with CS_CHAR_TYPE and
if you set client encoding to utf-8 you should be able to use utf-8.

>
> > Do you have an example so I can write a small unittests??
>
> I have extended the FreeTDS ctlib unit-test "rpc_ct_param.c", which is attached.
> Just ensure you have "client charset = UTF-8" in you freetds.conf

I'm merging your test. Code should work with either mssql and sybase
testing for unichar or nvarchar (I already wrote some code).

>
> Without the patch the unit-test gives:
>
> Open Client Message:
> Message number: LAYER = (0) ORIGIN = (0) SEVERITY = (9) NUMBER = (98)
> Message String: Error converting characters into server's character
> set. Some character(s) could not be converted
>
> Server message:
> Message number: 8016, Severity 16, State 26, Line 1
> Server 'xxxx'
> Message String: The incoming tabular data stream (TDS) remote
> procedure call (RPC) protocol stream is incorrect. Parameter 2
> ("@nvparam"): Data type 0xA7 has an invalid data length or metadata
> length.
>

Quite strange... I didn't get such error...

>
> > So you bind @email with datafmt->datatype == CS_UNICHAR_TYPE, isn't it ??
>
> Yes.
> I assumed:
>   CS_CHAR_TYPE = varchar = CP1252 ASCII
>   CS_UNICHAR_TYPE = nvarchar = UTF8

I looked at ctlib samples and not, CS_UNICHAR_TYPE means utf-16
(similar to ucs-2) so I'm updating the test to reflect this encoding.

>
> > Probably the second :) Well... a bug or a missing feature :)
> > CS_UNIVARCHAR_TYPE isn't better ??
>
> I see no CS_UNIVARCHAR_TYPE defined...


I found some documentation for CS_UNIVARCHAR_TYPE but I have to admit
that is not defined in Sybase headers.

>
> Regards,
>  Andrew Victor

bye
  freddy77
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.