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
This commit is contained in:
Julian Smart 2005-09-16 11:03:53 +00:00
parent a141e01844
commit e716b9bee1
4 changed files with 38 additions and 21 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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,