The ODBC API comes in two flavours, namely:
- SQLWCHAR is 16 bit integer / UTF-16
- SQLWCHAR is wchar_t
On Microsoft Windows, these two flavours coincide, but on most (all?) Unices, wchar_t is 32 bits (I presume UCS4).
On Unix, there are two "main" FLOSS implementations of ODBC:
unixodbc defaults to "SQLWCHAR is 16 bits", but supports the 32 bits case (#define SQL_WCHART_CONVERT).
iodbc seems to support only (?) the wchar_t case.
UnixODBC in GNU/Linux distributions, by and large, AFAIK follow the UnixODBC default of 16 bit SQLWCHAR.
On MacOS X, though, older versions ship iodbc (and 32 bit SQLWCHAR); newer versions do not ship the iodbc development headers anymore.
Need to find out what the ODBC story is for newer versions of MacOS X. The crucial question is: what ABI are ODBC drivers (for MacOS X) that people will use with LibreOffice compiled for? Should find out and align. E.g.: MySQL driver, PostgreSQL driver, etc.
http://www.opensource.apple.com/source/iodbc/iodbc-42.5/ (linked from http://www.opensource.apple.com/release/os-x-1094/) shows that the iODBC *libraries* are still provided by Apple, just not the headers. Thus, I expect that the standard of the iODBC ABI stays on MacOS X.
http://www.easysoft.com/developer/interfaces/odbc/64-bit.html#odbc-mac-os-x contains useful information, in particular that iODBC "upstream" distributes ODBC SDKs for MacOS X. Maybe we should just add this as an external to the LibreOffice build system and use it for MacOS X builds (instead of UnixODBC). Alternatively, we could just set SQL_WCHART_CONVERT for UnixODBC, it could work / is supposed to.
Fwiw ODBC access to my mysql local instance now works on OSX with stock TDF 184.108.40.206 and mysql 5.1 odbc connector
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "master":
fdo#83924 align with system ODBC ABI on MacOSX: SQL_WCHAR is wchar_t
The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
(In reply to comment #1)
> Alternatively, we could just set SQL_WCHART_CONVERT for UnixODBC,
> it could work / is supposed to.
I did that: on MacOS X without system ODBC headers, use our UnixODBC headers but set SQL_WCHART_CONVERT. This should work.
(plus follow-up fix: http://cgit.freedesktop.org/libreoffice/core/commit/?id=beed6cb8add346c017de212c5ee18fa786caed8b )