Length Arguments for Unicode ODBC Functions - ODBC Driver for Teradata

ODBC Driver for Teradata User Guide

Product
ODBC Driver for Teradata
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-07-11
dita:mapPath
smj1488824663219.ditamap
dita:ditavalPath
Audience_PDF_product_legacy_odbc_include.ditaval
dita:id
B035-2526
lifecycle
previous
Product Category
Teradata Tools and Utilities
Many ODBC interface functions expect string arguments that specify the length of character string input and output values. While some functions expect Unicode arguments to specify such lengths in bytes, others expect lengths to be specified as character counts. This varies by platform and Unicode encoding.
  • UTF-16/UTF-32 Encoded Unicode Strings: The following paragraph from the Unicode section of Chapter 17, “Programming Considerations,” of Microsoft ODBC 3.0 Programmer's Reference states the ultimate rule regarding the specification of length arguments in Unicode functions:

    “Unicode functions that always return or take strings or length arguments are passed as count of-characters. For functions that return length information for server data, the display size and precision are described in number of characters. When a length (transfer size of the data) could refer to string or non-string data, the length is described in octet lengths. For example, SQLGetInfoW will still take the length as count-of-bytes, but SQLExecDirectW will use count-of-characters.”

  • UTF-8 Encoded Unicode Strings on a UNIX System: UTF-8 is the default Unicode encoding for ODBC applications running on a UNIX system. All string length arguments to ODBC interface functions should be specified as count of bytes.