Bug #44968 Buffer length Vs column size for wide character resultset columns
Submitted: 20 May 0:04 Modified: 20 May 10:11
Reporter: Farid Zidan (Candidate Quality Contributor)
Status: Analyzing
Category:Connector/ODBC Severity:S5 (Performance)
Version:5.01.05.00 OS:Microsoft Windows (XP SP3)
Assigned to: Bogdan Degtyariov Target Version:

[20 May 0:04] Farid Zidan
Description:
Buffer length for wide char resultsets columns is a little too big for the reported
column size. Usually for wide char columns buffer length and column size do not fail this
assert:
ASSERT( nBufferLength == pRow->column_size * sizeof(wchar_t) );

rc = SQLColAttribute( hstmt, nCol,SQL_DESC_LENGTH, NULL,0, NULL,
(SQLLEN*) &pRow->column_size );

        // buffer length
        rc = SQLColAttribute( hstmt,
                              nCol,
                              SQL_DESC_OCTET_LENGTH,
                              NULL,
                              0,
                              NULL,
                              &pRow->buffer_length );

How to repeat:
select
trigger_name,
action_timing
from
information_schema.triggers

Describe the resultset using above two api calls I get the following column sizes: 64 and
6 and buffer sizes are reported as 193 and 19 respectively.
trigger_name	varchar(64)	SQL_WVARCHAR
action_timing	varchar(6)	SQL_WVARCHAR

Is this by design? seems that reported buffer size is (column_size*3 + 1) instead of the
usual column_size*2 for wide chars