[unixODBC-support] Question regarding whether SQLGetData() returns UCS2 data

Derek Lai dlai at actuate.com
Wed Dec 7 22:30:32 GMT 2005


I currently have a C program that uses the Wide (Unicode) API of ODBC, and it talks to the MyODBC driver via the unixODBC driver manager.  The platform is Linux.
The C program communicates with the unixODBC driver manager via UCS2, and the following calls are all working correctly:  SQLDriverConnectW(), SQLPrepareW(), SQLErrorW().   However, when I use SQLGetData() attempting to retrieve string data in UCS2 format, through specifying SQL_C_WCHAR, the call is returning garbage values.   I understand that the MyODBC driver is not unicode compatible yet, but I am expecting the driver manager to be able to convert the retrieved ANSI data and convert to UCS2 accordingly, similar to the way the Windows Driver Manager returns UCS2 data to the user.

Specifically, here is the odbc log of the call:

[ODBC][24142][SQLGetData.c][224]
                Entry:
                        Statement = 0x9661660
                        Column Number = 1
                        Target Type = -8 SQL_WCHAR
                        Buffer Length = 42
                        Target Value = 0x96ce178
                        StrLen Or Ind = 0xbfffb4fc
[ODBC][24142][SQLGetData.c][470]
                Exit:[SQL_SUCCESS]
                        Buffer = [
                        Strlen Or Ind = 0xbfffb4fc -> 0

If I specify SQL_C_CHAR in the call, then output buffer is returned fine in ANSI:

[ODBC][24569][SQLGetData.c][224]
                Entry:
                        Statement = 0x9661668
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 42
                        Target Value = 0x966b588
                        StrLen Or Ind = 0xbfff687c
[ODBC][24569][SQLGetData.c][470]
                Exit:[SQL_SUCCESS]
                        Buffer = [Signal Engineering]
                        Strlen Or Ind = 0xbfff687c -> 18

Please confirm if this is a defect, or if there is a chance that the SQLGetData() call can be enhanced to return UCS2 in future versions.

Thanks,
Derek.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20051207/1427880b/attachment.html>


More information about the unixODBC-support mailing list