X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e25cdb868f00e6a3d05c994f6fddacf4f24e5350..0425151023593cb31da0ee0a652da173ca9abfde:/src/common/db.cpp diff --git a/src/common/db.cpp b/src/common/db.cpp index 86dd614ad9..6f0e8dce24 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -53,9 +53,6 @@ #include "wx/object.h" #include "wx/list.h" #include "wx/utils.h" - #if wxUSE_GUI - #include "wx/msgdlg.h" - #endif #include "wx/log.h" #endif #include "wx/filefn.h" @@ -562,7 +559,8 @@ const wxChar *wxDb::convertUserID(const wxChar *userID, wxString &UserID) UserID.Empty(); // dBase does not use user names, and some drivers fail if you try to pass one - if (Dbms() == dbmsDBASE) + if ( Dbms() == dbmsDBASE + || Dbms() == dbmsXBASE_SEQUITER ) UserID.Empty(); // Oracle user names may only be in uppercase, so force @@ -722,13 +720,17 @@ bool wxDb::Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthSt { if (!getDataTypeInfo(SQL_DATE,typeInfDate)) { - if (!getDataTypeInfo(SQL_DATETIME,typeInfDate)) +#ifdef SQL_DATETIME + if (getDataTypeInfo(SQL_DATETIME,typeInfDate)) + { + typeInfDate.FsqlType = SQL_TIME; + } + else +#endif // SQL_DATETIME defined { if (failOnDataTypeUnsupported) return(FALSE); } - else - typeInfDate.FsqlType = SQL_TIME; } else typeInfDate.FsqlType = SQL_DATE; @@ -3062,7 +3064,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName) GetData(7,SQL_C_SLONG, (UCHAR *)&precision, 0, &cb); GetData(8,SQL_C_SLONG, (UCHAR *)&length, 0, &cb); - outStr.Printf(wxT("%-32s %-32s (%04d)%-15s %9d %9d\n"), + outStr.Printf(wxT("%-32s %-32s (%04d)%-15s %9ld %9ld\n"), tblName, colName, sqlDataType, typeName, precision, length); if (fputs(outStr.c_str(), fp) == EOF) { @@ -3494,6 +3496,9 @@ wxDBMS wxDb::Dbms(void) if (!wxStricmp(baseName,wxT("DBASE"))) return((wxDBMS)(dbmsType = dbmsDBASE)); + if (!wxStricmp(baseName,wxT("xBase"))) + return((wxDBMS)(dbmsType = dbmsXBASE_SEQUITER)); + if (!wxStricmp(baseName,wxT("MySQL"))) return((wxDBMS)(dbmsType = dbmsMY_SQL)); @@ -3561,21 +3566,30 @@ bool wxDb::ModifyColumn(const wxString &tableName, const wxString &columnName, case dbmsPOSTGRES : case dbmsACCESS : case dbmsDBASE : + case dbmsXBASE_SEQUITER : default : alterSlashModify = "MODIFY"; break; } // create the SQL statement - sqlStmt.Printf(wxT("ALTER TABLE \"%s\" \"%s\" \"%s\" %s"), tableName.c_str(), alterSlashModify.c_str(), + if ( Dbms() == dbmsMY_SQL ) + { + sqlStmt.Printf(wxT("ALTER TABLE %s %s %s %s"), tableName.c_str(), alterSlashModify.c_str(), + columnName.c_str(), dataTypeName.c_str()); + } + else + { + sqlStmt.Printf(wxT("ALTER TABLE \"%s\" \"%s\" \"%s\" %s"), tableName.c_str(), alterSlashModify.c_str(), columnName.c_str(), dataTypeName.c_str()); + } // For varchars only, append the size of the column if (dataType == DB_DATA_TYPE_VARCHAR && (Dbms() != dbmsMY_SQL || dataTypeName != "text")) { wxString s; - s.Printf(wxT("(%d)"), columnLength); + s.Printf(wxT("(%lu)"), columnLength); sqlStmt += s; } @@ -3741,7 +3755,7 @@ int WXDLLEXPORT wxDbConnectionsInUse(void) /********** wxDbLogExtendedErrorMsg() **********/ // DEBUG ONLY function -const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText, +const wxChar* WXDLLEXPORT wxDbLogExtendedErrorMsg(const wxChar *userText, wxDb *pDb, const wxChar *ErrFile, int ErrLine)