UTF8 and LOBs - OLE DB Provider for Teradata

OLE DB Provider for Teradata User Guide

Product
OLE DB Provider for Teradata
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
dita:id
B035-2498
Product Category
Teradata Tools and Utilities

UTF8 and LOBs

OLE DB Provider for Teradata reports incorrect values for the sizes of columns of the CHAR(n) data type when the session character set used is UTF8 and LOB support is not enabled. To help alleviate this shortcoming, OLE DB Provider for Teradata automatically enables LOB support when a connection is established (during processing of IDBInitialize::Initialize()) when all of the following are true:

  • The selected session character set is UTF8.
  • The connection is to Teradata DatabaseV2R5.1 or greater.
  • The EnableLOBSupport provider string attribute has not been specified with a value of NO.
  • An OLE DB provider rowset and command objects return column size information in the ulColumnSize field of the DBCOLUMNINFO structures returned by IColumnsInfo::GetColumnInfo() and in the DBCOLUMN_COLUMNSIZE column of the “column metadata rowset” (created by calling IColumnsRowset::GetColumnsRowset()). For columns of the CHAR(n) data type, this column size is n (the number of characters in the column) so that is what should be returned.

    However, when the UTF8 session character set is used and LOB support is not enabled, instead of returning n, OLE DB Provider for Teradata returns the number of bytes in the Teradata external representation of the data type. This value depends upon the server character set type and the database's export width table ID as shown in the following table. For more information on export width rules, see International Character Set Support:

     

    Table 16: Export Width 

     

    Export Width Table ID

    Data Type

    0 (Expected Default)

    1 (Compatibility Default)

    2 (Maximum Default)

    Char(n) Character SET UNICODE

    3*n

    3*n

    3*n

    Char(n) Character SET LATIN

    2*n

    2*n

    3*n

    Char(n) Character SET KANJISJIS

    n

    n

    3*n

    Char(n) Character SET GRAPHIC

    3*n

    3*n

    3*n