diff --git a/src/common/db.cpp b/src/common/db.cpp index 24a771f516..e37680defa 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -35,6 +35,7 @@ #include "wx/wxprec.h" + // Use this line for wxWindows v1.x //#include "wx_ver.h" // Use this line for wxWindows v2.x @@ -2463,8 +2464,8 @@ wxDBMS wxDb::Dbms(void) */ { wxChar baseName[25+1]; - wxStrncpy(baseName,dbInf.dbmsName,25); + if (!wxStricmp(dbInf.dbmsName,"Adaptive Server Anywhere")) return(dbmsSYBASE_ASA); if (!wxStricmp(dbInf.dbmsName,"SQL Server")) // Sybase Adaptive Server @@ -2480,6 +2481,7 @@ wxDBMS wxDb::Dbms(void) if (!wxStricmp(baseName,"Informix")) return(dbmsINFORMIX); + baseName[6] = 0; if (!wxStricmp(baseName,"Oracle")) return(dbmsORACLE); @@ -2487,6 +2489,8 @@ wxDBMS wxDb::Dbms(void) return(dbmsACCESS); if (!wxStricmp(dbInf.dbmsName,"MySQL")) return(dbmsMY_SQL); + if (!wxStricmp(baseName,"Sybase")) + return(dbmsSYBASE_ASA); baseName[5] = 0; if (!wxStricmp(baseName,"DBASE")) diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index c61d9e9b7e..39d4c33a06 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -559,8 +559,7 @@ bool wxDbTable::query(int queryType, bool forUpdate, bool distinct, const char * return(FALSE); // Execute the SQL SELECT statement - int retcode; - + int retcode; retcode = SQLExecDirect(hstmt, (UCHAR FAR *) (queryType == DB_SELECT_STATEMENT ? pSqlStmt : sqlStmt), SQL_NTS); if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) return(pDb->DispAllErrors(henv, hdbc, hstmt)); @@ -1077,11 +1076,12 @@ bool wxDbTable::DropTable() if (SQLExecDirect(hstmt, (UCHAR FAR *) sqlStmt.c_str(), SQL_NTS) != SQL_SUCCESS) { // Check for "Base table not found" error and ignore - pDb->GetNextError(henv, hdbc, hstmt); + pDb->GetNextError(henv, hdbc, hstmt); if (wxStrcmp(pDb->sqlState,"S0002")) // "Base table not found" { // Check for product specific error codes if (!((pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"42000")) || // 5.x (and lower?) + (pDb->Dbms() == dbmsSYBASE_ASA && !wxStrcmp(pDb->sqlState,"37000")) || (pDb->Dbms() == dbmsMY_SQL && !wxStrcmp(pDb->sqlState,"S1000")) || // untested (pDb->Dbms() == dbmsPOSTGRES && !wxStrcmp(pDb->sqlState,"08S01")))) // untested {