[freetds] CTLib patch
Andrew Victor
avictor.za at gmail.com
Wed Jun 17 17:01:48 EDT 2009
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.
> 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
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.
> 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
> Probably the second :) Well... a bug or a missing feature :)
> CS_UNIVARCHAR_TYPE isn't better ??
I see no CS_UNIVARCHAR_TYPE defined...
Regards,
Andrew Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rpc_ct_param.c
Type: text/x-csrc
Size: 16951 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20090617/4a1ae11f/attachment.bin
More information about the FreeTDS
mailing list