ODBC32: preliminary Unicode implementation of ODBC functions
Alex Villacis Lasso
a_villacis at palosanto.com
Mon Jan 24 10:54:32 CST 2005
This started because I wanted to run an application which uses ActiveX
Data Objects (ADO) under Wine, and I did not want to use the native ODBC
manager, but the builtin one. I then discovered that ADO relies almost
exclusively on Unicode calls to ODBC, which are currently unimplemented
in Wine. So, I spent a weekend writing ODBC proxies for the Unicode
functions. This was greatly aided by the fact that UnixODBC already
provides Unicode versions of its exported functions, so all I had to do
(in theory) was to load them in the same way as the ANSI versions. It
seems that iODBC also provides Unicode versions of these functions
(untested).
However, there are a few notes about this implementation:
* Some functions have to "cheat" in order to allow ADO to run normally.
By "cheat", I mean to report success to ADO even when the function
actually failed. ADO seems to be picky on the SQLSetStmtAttrW function,
and throws an exception when it is reported that the attributes
SQL_ROWSET_SIZE or SQL_ATTR_ROW_ARRAY_SIZE failed to be set. However, it
seems that ADO still runs correctly when lied about these two attributes
alone.
* Another issue is that of translation on the functions
SQLColAttributesW and SQLColAttributeW. When a string attribute is
requested on a column, UnixODBC returns a *character* count. However,
the Windows ODBC returns a *byte* count, and ADO so expects it. Ignoring
this issue results in corrupted column names in ADO. So the proxy checks
for the byte/character distinction for known string attributes, and
recalculates the byte length as necessary. There could be more functions
which require this translation, but SQLColAttribute(s)W was the absolute
minimum required for ADO.
This implementation allows any ADO application which uses a DSN for
connecting to have a chance of working with the builtin ODBC proxy.
Applications which use DSN-less connection strings are (still) out of
luck, because this requires low-level ODBC support which is (currently)
not present in UnixODBC.
All tests performed against a Linux MySQL database using the Linux
MyODBC 3.51 driver.
Changelog
* Implemented Unicode proxy for ODBC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-odbc32-unicode-implementation.patch
Type: text/x-patch
Size: 52000 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050124/23494d9c/wine-odbc32-unicode-implementation.bin
More information about the wine-patches
mailing list