SWORD scale = 0;
// Bind each column (that can be inserted) of the table to a parameter marker
- int i;
- for (i = 0; i < noCols; i++)
+ int i,colNo;
+ for (i = 0, colNo = 1; i < noCols; i++)
{
if (! colDefs[i].InsertAllowed)
continue;
colDefs[i].CbValue = SQL_NULL_DATA;
colDefs[i].Null = FALSE;
}
- if (SQLBindParameter(hstmtInsert, i+1, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
+ if (SQLBindParameter(hstmtInsert, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj,
precision+1,&colDefs[i].CbValue) != SQL_SUCCESS)
return(pDb->DispAllErrors(henv, hdbc, hstmtInsert));
/********** 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++)
SetColDefs (index,pColInfs[index].colName,pColInfs[index].dbDataType, pColDataPtrs[index].PtrDataObj, pColDataPtrs[index].SqlCtype, pColDataPtrs[index].SzDataObj);
}
}
- return (TRUE);
+ return (pColDataPtrs);
} // wxTable::SetColDef()