#endif
#ifdef DBDEBUG_CONSOLE
- #include "iostream.h"
+#if wxUSE_IOSTREAMH
+ #include <iostream.h>
+#else
+ #include <iostream>
+#endif
#include "wx/ioswrap.h"
#endif
/********** wxDbTable::bindCols() **********/
bool wxDbTable::bindCols(HSTMT cursor)
{
+ static SDWORD cb;
+
// Bind each column of the table to a memory address for fetching data
UWORD i;
for (i = 0; i < noCols; i++)
{
+ cb = colDefs[i].CbValue;
if (SQLBindCol(cursor, (UWORD)(i+1), colDefs[i].SqlCtype, (UCHAR*) colDefs[i].PtrDataObj,
- colDefs[i].SzDataObj, &colDefs[i].CbValue ) != SQL_SUCCESS)
- {
+ colDefs[i].SzDataObj, &cb ) != SQL_SUCCESS)
return (pDb->DispAllErrors(henv, hdbc, cursor));
- }
}
// Completed successfully
bool firstColumn = TRUE;
pSqlStmt.Printf(wxT("UPDATE %s SET "),
- pDb->SQLTableName(tableName.Upper().c_str()).c_str());
+ pDb->SQLTableName(tableName.c_str()).c_str());
// Append a list of columns to be updated
int i;
break;
}
// For varchars, append the size of the string
- if (colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR)// ||
+ if (colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR &&
+ (pDb->Dbms() != dbmsMY_SQL || pDb->GetTypeInfVarchar().TypeName != "text"))// ||
// colDefs[i].DbDataType == DB_DATA_TYPE_BLOB)
{
wxString s;
if (j++) // Multi part key, comma separate names
sqlStmt += wxT(",");
sqlStmt += pDb->SQLColumnName(colDefs[i].ColName);
-// sqlStmt += colDefs[i].ColName;
+
+ if (pDb->Dbms() == dbmsMY_SQL &&
+ colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR)
+ {
+ wxString s;
+ s.Printf(wxT("(%d)"), colDefs[i].SzDataObj);
+ sqlStmt += s;
+ }
}
}
sqlStmt += wxT(")");
SWORD cType, int size, bool keyField, bool upd,
bool insAllow, bool derivedCol)
{
+ wxASSERT_MSG( index < noCols,
+ _T("Specified column index exceeds the maximum number of columns for this table.") );
+
if (!colDefs) // May happen if the database connection fails
return;