new 'dynamic' SetColDefs fix

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bart A.M. Jourquin 2000-01-21 10:52:04 +00:00
parent a46dafc834
commit 1b7274a8c0
2 changed files with 10 additions and 13 deletions

View File

@ -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);

View File

@ -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()