From 13d12797d27129b8c1d36adbb8f9a512503035b1 Mon Sep 17 00:00:00 2001 From: "Bart A.M. Jourquin" Date: Fri, 25 Feb 2000 16:27:24 +0000 Subject: [PATCH] Tentative fix for UNICODE git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dbtable.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index d640ddd82c..f06cccced6 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -1783,16 +1783,18 @@ wxColDataPtr* wxTable::SetColDefs (wxColInf *pColInfs, ULONG numCols) case DB_DATA_TYPE_VARCHAR: { - // Be sure to allocate enough memory - if (pColInfs[index].bufferLength >= pColInfs[index].columnSize) - { - pColDataPtrs[index].PtrDataObj = new char[pColInfs[index].bufferLength+1]; - pColDataPtrs[index].SzDataObj = pColInfs[index].bufferLength; - } - else + // Tentative fix for Access. Relative to UNICODE? + if (pColInfs[index].bufferLength == 2*pColInfs[index].columnSize) { pColDataPtrs[index].PtrDataObj = new char[pColInfs[index].columnSize+1]; pColDataPtrs[index].SzDataObj = pColInfs[index].columnSize; + + } + else + { + // Still needed because iodbc (unix) returns 0 in columnSize + pColDataPtrs[index].PtrDataObj = new char[pColInfs[index].bufferLength+1]; + pColDataPtrs[index].SzDataObj = pColInfs[index].bufferLength; } pColDataPtrs[index].SqlCtype = SQL_C_CHAR; break;