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:
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:
|
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 |