Skip to Content.
Sympa Menu

freetds - [freetds] SQLWCHAR support - RFC (request for comments)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] SQLWCHAR support - RFC (request for comments)
  • Date: Tue, 29 Jan 2008 16:32:09 +0100

Hi,
I'm starting writing support for SQLWCHAR in odbc! Not for 0.82! I
found however some problems:
1- libTDS do not support wide characters nor dblib or ctlib
2- I need to provide both normal API and wide one
3- I don't want to break current compatibility
4- I don't want to make too much conversions!
5- I don't want to waste too much space

1) I can write support for wide characters in libTDS but I presume I
would add code that only odbc will use
2) however libTDS do not support two type of encoding. If I use only one
encoding I have to use or wide characters directly or utf8. utf-8 will
help to reduce libTDS changes moving all conversions to odbc layer
3) that is client can specify normal encoding (not wide of course!)
4) the better is to convert at most 1 time... using utf8 on libtds would
lead to two conversions for wide and at most 2 for multibyte (if not
utf8), using wide would lead to mostly 1 conversion for wide characters
and two conversions for multibyte (probably 95% on a Unix machine!)
5) using onle wide a string like "foo" will take 6 or 12 bytes.

Also there is a hole in ODBC specification cause encoding is not handled
that fine... unixODBC assume client is iso8859-1 doing multibyte <->
wide characters conversions (this is not a problem if driver support
both multibyte and wide cause unixODBC won't do any conversion but
assume driver provide utf8 as multibyte and application wants wide
characters...)

I think that perhaps an option is to provide a way to disable
conversions in libTDS and handle conversions using lazy evaluations! The
problem however is on metadata (column names and so on) which are used
in query.c to compute statements to send. I think in this case utf8
would help. Another problem is conversions in libtds. convert.c support
only C strings. We could translate wide -> multibyte as needed but it do
not works in all situations (like WCHAR -> WCHAR or WCHAR -> BINARY).
Also I don't know how convert.c can handle chinese/japanese/cyrillic
date (think at day names) without using utf8...

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page