From e716b9bee14786f7a73da502fbd601c57ce03ebc Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 16 Sep 2005 11:03:53 +0000 Subject: [PATCH] Applied patch [ 1286701 ] fix for compiling odbc with MS VC8 on x64 also define SQLTCHAR for DMC++ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35517 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/db.h | 19 ++++++++++++++++++- include/wx/dbtable.h | 2 +- src/common/db.cpp | 26 +++++++++++++------------- src/common/dbtable.cpp | 12 ++++++------ 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/include/wx/db.h b/include/wx/db.h index fef0255e70..e27694b66d 100644 --- a/include/wx/db.h +++ b/include/wx/db.h @@ -99,6 +99,14 @@ #define SQL_C_WXCHAR SQL_C_CHAR #endif +#ifdef __DIGITALMARS__ +#if wxUSE_UNICODE +typedef wxChar SQLTCHAR; +#else +typedef UCHAR SQLTCHAR; +#endif +#endif + typedef float SFLOAT; typedef double SDOUBLE; typedef unsigned int UINT; @@ -126,6 +134,15 @@ enum enumDummy {enumDum1}; #endif #endif +#ifndef _WIN64 +#ifndef SQLLEN +#define SQLLEN SQLINTEGER +#endif +#ifndef SQLULEN +#define SQLULEN SQLUINTEGER +#endif +#endif + const int wxDB_PATH_MAX = 254; extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_LOG_FILENAME; @@ -652,7 +669,7 @@ public: bool ExecSql(const wxString &pSqlStmt); bool ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols); bool GetNext(void); - bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned); + bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SQLLEN FAR *cbReturned); bool Grant(int privileges, const wxString &tableName, const wxString &userList = wxT("PUBLIC")); int TranslateSqlState(const wxString &SQLState); wxDbInf *GetCatalog(const wxChar *userID=NULL); diff --git a/include/wx/dbtable.h b/include/wx/dbtable.h index 4023c3b13a..0abe7c8da3 100644 --- a/include/wx/dbtable.h +++ b/include/wx/dbtable.h @@ -59,7 +59,7 @@ public: bool Updateable; // Specifies whether this column is updateable bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement bool DerivedCol; // Specifies whether this column is a derived value - SDWORD CbValue; // Internal use only!!! + SQLLEN CbValue; // Internal use only!!! bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates wxDbColDef(); diff --git a/src/common/db.cpp b/src/common/db.cpp index 23897877c9..95549389f4 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -1611,7 +1611,7 @@ bool wxDb::getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo) * wxDbSqlTypeInfo is a structure that is filled in with data type information, */ RETCODE retcode; - SDWORD cbRet; + SQLLEN cbRet; // Get information about the data type specified if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS) @@ -2249,7 +2249,7 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol short colNum; wxChar name[DB_MAX_COLUMN_NAME_LEN+1]; SWORD Sword; - SDWORD Sdword; + SQLLEN Sqllen; wxDbColInf* pColInf = new wxDbColInf[noCols]; // Fill in column information (name, datatype) @@ -2257,7 +2257,7 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol { if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_NAME, name, sizeof(name), - &Sword, &Sdword) != SQL_SUCCESS) + &Sword, &Sqllen) != SQL_SUCCESS) { DispAllErrors(henv, hdbc, hstmt); delete[] pColInf; @@ -2268,14 +2268,14 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol pColInf[colNum].colName[DB_MAX_COLUMN_NAME_LEN] = 0; // Prevent buffer overrun if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_TYPE, - NULL, 0, &Sword, &Sdword) != SQL_SUCCESS) + NULL, 0, &Sword, &Sqllen) != SQL_SUCCESS) { DispAllErrors(henv, hdbc, hstmt); delete[] pColInf; return false; } - switch (Sdword) + switch (Sqllen) { #if wxUSE_UNICODE #if defined(SQL_WCHAR) @@ -2312,7 +2312,7 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol #ifdef __WXDEBUG__ default: wxString errMsg; - errMsg.Printf(wxT("SQL Data type %ld currently not supported by wxWidgets"), (long)Sdword); + errMsg.Printf(wxT("SQL Data type %ld currently not supported by wxWidgets"), (long)Sqllen); wxLogDebug(errMsg,wxT("ODBC DEBUG MESSAGE")); #endif } @@ -2337,7 +2337,7 @@ bool wxDb::GetNext(void) /********** wxDb::GetData() **********/ -bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned) +bool wxDb::GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SQLLEN FAR *cbReturned) { wxASSERT(pData); wxASSERT(cbReturned); @@ -2367,7 +2367,7 @@ int wxDb::GetKeyFields(const wxString &tableName, wxDbColInf* colInf, UWORD noCo wxChar szPkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Primary key column */ wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */ SQLRETURN retcode; - SDWORD cb; + SQLLEN cb; SWORD i; wxString tempStr; /* @@ -2534,7 +2534,7 @@ wxDbColInf *wxDb::GetColumns(wxChar *tableName[], const wxChar *userID) wxDbColInf *colInf = 0; RETCODE retcode; - SDWORD cb; + SQLLEN cb; wxString TableName; @@ -2693,7 +2693,7 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, UWORD *numCols, const wx wxDbColInf *colInf = 0; RETCODE retcode; - SDWORD cb; + SQLLEN cb; wxString TableName; @@ -3306,7 +3306,7 @@ wxDbInf *wxDb::GetCatalog(const wxChar *userID) int noTab = 0; // Counter while filling table entries int pass; RETCODE retcode; - SDWORD cb; + SQLLEN cb; wxString tblNameSave; wxString UserID; @@ -3417,7 +3417,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName) wxASSERT(fileName.Length()); RETCODE retcode; - SDWORD cb; + SQLLEN cb; wxChar tblName[DB_MAX_TABLE_NAME_LEN+1]; wxString tblNameSave; wxChar colName[DB_MAX_COLUMN_NAME_LEN+1]; @@ -3614,7 +3614,7 @@ bool wxDb::TablePrivileges(const wxString &tableName, const wxString &priv, cons wxASSERT(tableName.Length()); wxDbTablePrivilegeInfo result; - SDWORD cbRetVal; + SQLLEN cbRetVal; RETCODE retcode; // We probably need to be able to dynamically set this based on diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index d5f848518b..7e5b6f1bd0 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -560,7 +560,7 @@ bool wxDbTable::bindUpdateParams(void) /********** wxDbTable::bindCols() **********/ bool wxDbTable::bindCols(HSTMT cursor) { - static SDWORD cb; + static SQLLEN cb; // Bind each column of the table to a memory address for fetching data UWORD i; @@ -586,7 +586,7 @@ bool wxDbTable::getRec(UWORD fetchType) if (!pDb->FwdOnlyCursors()) { // Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType - UDWORD cRowsFetched; + SQLULEN cRowsFetched; UWORD rowStatus; retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus); @@ -1010,7 +1010,7 @@ void wxDbTable::BuildDeleteStmt(wxString &pSqlStmt, int typeOfDel, const wxStrin // e.g. DELETE FROM PARTS WHERE ROWID = '111.222.333' if (CanUpdateByROWID()) { - SDWORD cb; + SQLLEN cb; wxChar rowid[wxDB_ROWID_LEN+1]; // Get the ROWID value. If not successful retreiving the ROWID, @@ -1227,7 +1227,7 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpdate, const wxSt // e.g. UPDATE PARTS SET Col1 = ?, Col2 = ? WHERE ROWID = '111.222.333' if (CanUpdateByROWID()) { - SDWORD cb; + SQLLEN cb; wxChar rowid[wxDB_ROWID_LEN+1]; // Get the ROWID value. If not successful retreiving the ROWID, @@ -2431,7 +2431,7 @@ ULONG wxDbTable::Count(const wxString &args) { ULONG count; wxString sqlStmt; - SDWORD cb; + SQLLEN cb; // Build a "SELECT COUNT(*) FROM queryTableName [WHERE whereClause]" SQL Statement sqlStmt = wxT("SELECT COUNT("); @@ -2522,7 +2522,7 @@ bool wxDbTable::Refresh(void) if (CanUpdateByROWID()) { - SDWORD cb; + SQLLEN cb; wxChar rowid[wxDB_ROWID_LEN+1]; // Get the ROWID value. If not successful retreiving the ROWID, -- 2.45.2