Skip to Content.
Sympa Menu

freetds - RE: [freetds] collate and TDS8

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'freetds AT lists.ibiblio.org'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] collate and TDS8
  • Date: Fri, 6 Dec 2002 15:05:29 -0500

Does anyone in our mailing list audience have the following server
configuration?

* MS SQL Server 2000
* Unicode collation != 1033 (General Unicode)
* character set != iso_1

If you do and you're interested in this problem, I'd like to compare notes
with you.

Details follow.

> From: ZIGLIO Frediano [mailto:Frediano.Ziglio AT vodafoneomnitel.it]
> Sent: December 6, 2002 11:51 AM
>
> Collate are only available in mssql2k only using TDS8 (not TDS7).
> Is you enable TDS8 you put data on mssql2k we must give
> collate informations
> or sql process fault...
> Try to enable TDS8 and do a make check,
> src/tds/unittests/dynamic1 test fail for this reason.

Thanks for fixing token.c!

> The problem is: what data should be passed and in which order ??
> Collapse data are 5 bytes:
> - first 2 are windows code (0x409 for english), coded in
> little endian

That's 1033 decimal, a "locale id" (lcid). Try this:

1> select langid, lcid, msglangid, cast(name as char(30)) as name from
syslanguages where langid = @@LANGID
2> go
langid lcid msglangid name
------ ----------- --------- ------------------------------
0 1033 1033 us_english

> - 2 bytes ???

My next two bytes are always 00 01:

0020 09 04 00 01 00 11 52 00 65 00 67 00 69 00 6f 00 |......R. e.g.i.o.|

The first byte (zero) might be @@langid.

The second byte (one) might be the syscharset.id, cf. "Character sets" and
"Sort Orders" in Books Online. But take care:

1> select c.id, min(a.id), max(a.id), cast(c.name as char(30)) as name from
syscharsets c join syscharsets a on a.csid = c.id group by c.id, c.name
2> go
id name
--- ---- ---- ------------------------------
1 50 186 iso_1
2 40 61 cp850
3 30 34 cp437
4 80 98 cp1250
5 104 108 cp1251
6 112 124 cp1253
7 128 130 cp1254
8 136 138 cp1255
9 144 146 cp1256
10 152 160 cp1257
12 194 201 cp949
13 196 202 cp950
14 198 203 cp936
15 204 206 cp874
109 192 200 cp932

master..syscharsets.id is badly named and denormalized, IOW (also note
"type" is clearly an encoded value). The table should really be called
"sysortorders", because the id column identifies a sort order, not a
character set. The only character set names in that table those listed
above (whose csid is 0).

> - last byte is id in syscharsets

Not for me, my fifth byte is zero.

> Is id fixed (always the sames) ?

Doubtful.

> Can we just pass 0 ?

Perhaps for now.

> SQL server send this type of data during login?

No idea.

Interesting problem.

Regards,

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page