From: Bart A.M. Jourquin Date: Fri, 21 Jan 2000 10:52:04 +0000 (+0000) Subject: new 'dynamic' SetColDefs fix X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1b7274a8c071f0bbe4a19168e9b9b4981c06a8af?ds=sidebyside new 'dynamic' SetColDefs fix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dbtable.h b/include/wx/dbtable.h index 5e2daec0ad..5d27927e2a 100644 --- a/include/wx/dbtable.h +++ b/include/wx/dbtable.h @@ -194,7 +194,10 @@ public: void SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType, int size, bool keyField = FALSE, bool upd = TRUE, bool insAllow = TRUE, bool derivedCol = FALSE); - bool SetColDefs (wxColInf *colInfs, ULONG numCols, wxColDataPtr *pColDataPtrs); + // BJO20000121 : new prototype + // bool SetColDefs (wxColInf *colInfs, ULONG numCols, wxColDataPtr *pColDataPtrs); + wxColDataPtr* SetColDefs (wxColInf *colInfs, ULONG numCols); + HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE); bool DeleteCursor(HSTMT *hstmtDel); void SetCursor(HSTMT *hstmtActivate = (void **) DEFAULT_CURSOR); diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index e25776555c..f73f17089d 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -1727,24 +1727,18 @@ void wxTable::SetColDefs (int index, const char *fieldName, int dataType, void * /********** wxTable::SetColDef() **********/ -bool wxTable::SetColDefs(wxColInf *pColInfs, ULONG numCols, wxColDataPtr *pColDataPtrs) +// BJO20000121 : changed prototype in order to return proper pointer on wxColDataPtr's array +//bool wxTable::SetColDefs(wxColInf *pColInfs, ULONG numCols, wxColDataPtr *pColDataPtrs) +wxColDataPtr* wxTable::SetColDefs (wxColInf *pColInfs, ULONG numCols) { assert(pColInfs); + wxColDataPtr *pColDataPtrs; if (pColInfs) { ULONG index; - // BJO 991210: This doesn't seem to work. I solved this - // by allocating memory in the tables ctor: - // - // MyTable::MyTable(wxDB *pDB, char *Name, int NbCols, wxColInf *ColInfo): - // wxTable(pDB, Name, NbCols) - // { - // m_FreeDbConn = !pDB; - // m_DataPtrs = new wxColDataPtr[NbCols]; - // SetColDefs(ColInfo, NbCols, m_DataPtrs); - // } + pColDataPtrs = new wxColDataPtr[numCols+1]; for (index = 0; index < numCols; index++) @@ -1824,7 +1818,7 @@ bool wxTable::SetColDefs(wxColInf *pColInfs, ULONG numCols, wxColDataPtr *pColDa SetColDefs (index,pColInfs[index].colName,pColInfs[index].dbDataType, pColDataPtrs[index].PtrDataObj, pColDataPtrs[index].SqlCtype, pColDataPtrs[index].SzDataObj); } } - return (TRUE); + return (pColDataPtrs); } // wxTable::SetColDef()