I'm sorry Fabio but it doesn't explain inconsistency between NVARCHAR, NCHAR and NTEXT() mapping to a memo field. In other words, why SQL_WVARCHAR is mapped to SQL_C_WCHAR but SQL_CHAR and and SQL_WLONGVARCHAR are mapped to SQL_C_CHAR in this case.
When a application like VFP get ODBC data, it do this:
- call SQLColAttributes SQL_COLUMN_TYPE
.....
- alloc a memory buffer for the SQL_COLUMN_TYPE
- call SQLFetch for fill the ODBC buffer
- call SQLGetData SQL_C_CHAR <== Is the ODBC driver that copy the data !
If VFP do not alloc a buffer with 2*N bytes,
it cannot call SQLGetData SQL_C_WCHAR because this would generate a overrun buffer.
Fabio