X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/519cb848a8f4c91c73421bb75314754284e593a4..61f0d452ea7e47fea18d0ab748095dc42d7dd66d:/src/common/dbtable.cpp?ds=sidebyside diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index 1ee5fb07ed..1113157d90 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -40,17 +40,22 @@ #endif #ifdef DBDEBUG_CONSOLE -# include + #include #endif #ifdef __BORLANDC__ - #pragma hdrstop + #pragma hdrstop #endif //__BORLANDC__ #if wxMAJOR_VERSION == 2 -# ifndef WX_PRECOMP -# include "wx/wx.h" -# endif //WX_PRECOMP + #ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/object.h" + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/msgdlg.h" + #endif + #include "wx/filefn.h" #endif #if wxMAJOR_VERSION == 1 @@ -77,8 +82,15 @@ #endif #ifdef __MWERKS__ +#ifdef __WXMSW__ #define stricmp _stricmp #define strnicmp _strnicmp +#else +int strcasecmp(const char *str_1, const char *str_2) ; +int strncasecmp(const char *str_1, const char *str_2, size_t maxchar) ; +#define stricmp strcasecmp +#define strnicmp strncasecmp +#endif #endif #ifdef __UNIX__ @@ -95,7 +107,7 @@ ULONG lastTableID = 0; -#if __WXDEBUG__ > 0 +#ifdef __WXDEBUG__ wxList TablesInUse; #endif @@ -144,7 +156,7 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, tableID = ++lastTableID; sprintf(s, "wxTable constructor (%-20s) tableID:[%6lu] pDb:[%p]", tblName,tableID,pDb); -#if __WXDEBUG__ > 0 +#ifdef __WXDEBUG__ CstructTablesInUse *tableInUse; tableInUse = new CstructTablesInUse(); tableInUse->tableName = tblName; @@ -186,7 +198,7 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, { // Check to see if cursor type is supported pDb->GetNextError(henv, hdbc, hstmtInternal); - if (! strcmp(pDb->sqlState, "01S02")) // Option Value Changed + if (! wxStrcmp(pDb->sqlState, "01S02")) // Option Value Changed { // Datasource does not support static cursors. Driver // will substitute a cursor type. Call SQLGetStmtOption() @@ -250,8 +262,7 @@ wxTable::~wxTable() pDb->WriteSqlLog(s); } -#ifndef PROGRAM_FP4UPG -#if __WXDEBUG__ > 0 +#ifdef __WXDEBUG__ if (tableID) { bool found = FALSE; @@ -276,7 +287,7 @@ wxTable::~wxTable() } } #endif -#endif + // Decrement the wxDB table count if (pDb) pDb->nTables--; @@ -566,18 +577,22 @@ bool wxTable::getRec(UWORD fetchType) { RETCODE retcode; -#ifndef FWD_ONLY_CURSORS +#if !wxODBC_FWD_ONLY_CURSORS + // Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType UDWORD cRowsFetched; UWORD rowStatus; - if ((retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus)) != SQL_SUCCESS) + +// if ((retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus)) != SQL_SUCCESS) + retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus); + if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) if (retcode == SQL_NO_DATA_FOUND) return(FALSE); else return(pDb->DispAllErrors(henv, hdbc, hstmt)); #else - // Fetch the next record from the record set + // Fetch the next record from the record set retcode = SQLFetch(hstmt); if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) { @@ -942,12 +957,12 @@ bool wxTable::DropTable() { // Check for "Base table not found" error and ignore pDb->GetNextError(henv, hdbc, hstmt); - if (strcmp(pDb->sqlState,"S0002")) // "Base table not found" + if (wxStrcmp(pDb->sqlState,"S0002")) // "Base table not found" { // Check for product specific error codes - if (!((pDb->Dbms() == dbmsSYBASE_ASA && !strcmp(pDb->sqlState,"42000")) || // 5.x (and lower?) - (pDb->Dbms() == dbmsMY_SQL && !strcmp(pDb->sqlState,"S1000")) || // untested - (pDb->Dbms() == dbmsPOSTGRES && !strcmp(pDb->sqlState,"08S01")))) // untested + if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // 5.x (and lower?) + (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,"S1000")) || // untested + (pDb->Dbms() == dbmsPOSTGRES && !wxStrcmp(pDb->sqlState,"08S01")))) // untested { pDb->DispNextError(); pDb->DispAllErrors(henv, hdbc, hstmt); @@ -1061,12 +1076,12 @@ bool wxTable::DropIndex(char * idxName) { // Check for "Index not found" error and ignore pDb->GetNextError(henv, hdbc, hstmt); - if (strcmp(pDb->sqlState,"S0012")) // "Index not found" + if (wxStrcmp(pDb->sqlState,"S0012")) // "Index not found" { // Check for product specific error codes - if (!((pDb->Dbms() == dbmsSYBASE_ASA && !strcmp(pDb->sqlState,"42000")) || // v5.x (and lower?) - (pDb->Dbms() == dbmsSYBASE_ASE && !strcmp(pDb->sqlState,"S0002")) || // Base table not found - (pDb->Dbms() == dbmsMY_SQL && !strcmp(pDb->sqlState,"42S02")) // untested + if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // v5.x (and lower?) + (pDb->Dbms() == dbmsSYBASE_ASE && !wxStrcmp(pDb->sqlState,"S0002")) || // Base table not found + (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,"42S02")) // untested )) { pDb->DispNextError(); @@ -1103,7 +1118,7 @@ int wxTable::Insert(void) { // Check to see if integrity constraint was violated pDb->GetNextError(henv, hdbc, hstmtInsert); - if (! strcmp(pDb->sqlState, "23000")) // Integrity constraint violated + if (! wxStrcmp(pDb->sqlState, "23000")) // Integrity constraint violated return(DB_ERR_INTEGRITY_CONSTRAINT_VIOL); else { @@ -1769,7 +1784,7 @@ bool wxTable::SetNull(char *colName) int i; for (i = 0; i < noCols; i++) { - if (!stricmp(colName, colDefs[i].ColName)) + if (!wxStricmp(colName, colDefs[i].ColName)) break; }