11 The SQL Server Wire Protocol Driver : Unicode Support

Unicode Support
The SQL Server Wire Protocol driver maps the Microsoft SQL Server data types to Unicode data types as shown in the following table:

1
Supported only for Microsoft SQL Server 2008.

2
Datetimeoffset mapping changes based on the setting of the Fetch TSWTZ as Timestamp option.

The driver supports the Unicode ODBC W (Wide) function calls, such as SQLConnectW. This allows the Driver Manager to transmit these calls directly to the driver. Otherwise, the Driver Manager would incur the additional overhead of converting the W calls to ANSI function calls, and vice versa.
See “UTF-16 Applications on UNIX and Linux” for related details. Also, refer to Chapter 4 “Internationalization, Localization, and Unicode” in the DataDirect Connect Series for ODBC Reference for a more detailed explanation of Unicode.
Using the XML Data Type
By default, Microsoft SQL Server returns XML data to the driver encoded as UTF-8. To avoid data loss, an application must bind XML data as SQL_C_WCHAR. The driver then returns the data as either UTF-8 or UTF-16, depending on platform and application settings. If the application binds XML data as SQL_C_CHAR, the driver converts it to the client character encoding, possibly causing data loss or corruption. To prevent any conversion of XML data, the application must set the attribute XML Describe Type to SQL_LONGVARBINARY (-10) and bind the data as SQL_C_BINARY.