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:
@@ -99,6 +99,14 @@
|
|||||||
#define SQL_C_WXCHAR SQL_C_CHAR
|
#define SQL_C_WXCHAR SQL_C_CHAR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __DIGITALMARS__
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
typedef wxChar SQLTCHAR;
|
||||||
|
#else
|
||||||
|
typedef UCHAR SQLTCHAR;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef float SFLOAT;
|
typedef float SFLOAT;
|
||||||
typedef double SDOUBLE;
|
typedef double SDOUBLE;
|
||||||
typedef unsigned int UINT;
|
typedef unsigned int UINT;
|
||||||
@@ -126,6 +134,15 @@ enum enumDummy {enumDum1};
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN64
|
||||||
|
#ifndef SQLLEN
|
||||||
|
#define SQLLEN SQLINTEGER
|
||||||
|
#endif
|
||||||
|
#ifndef SQLULEN
|
||||||
|
#define SQLULEN SQLUINTEGER
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
const int wxDB_PATH_MAX = 254;
|
const int wxDB_PATH_MAX = 254;
|
||||||
|
|
||||||
extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_LOG_FILENAME;
|
extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_LOG_FILENAME;
|
||||||
@@ -652,7 +669,7 @@ public:
|
|||||||
bool ExecSql(const wxString &pSqlStmt);
|
bool ExecSql(const wxString &pSqlStmt);
|
||||||
bool ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols);
|
bool ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols);
|
||||||
bool GetNext(void);
|
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"));
|
bool Grant(int privileges, const wxString &tableName, const wxString &userList = wxT("PUBLIC"));
|
||||||
int TranslateSqlState(const wxString &SQLState);
|
int TranslateSqlState(const wxString &SQLState);
|
||||||
wxDbInf *GetCatalog(const wxChar *userID=NULL);
|
wxDbInf *GetCatalog(const wxChar *userID=NULL);
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
bool Updateable; // Specifies whether this column is updateable
|
bool Updateable; // Specifies whether this column is updateable
|
||||||
bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement
|
bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement
|
||||||
bool DerivedCol; // Specifies whether this column is a derived value
|
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
|
bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates
|
||||||
|
|
||||||
wxDbColDef();
|
wxDbColDef();
|
||||||
|
@@ -1611,7 +1611,7 @@ bool wxDb::getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo)
|
|||||||
* wxDbSqlTypeInfo is a structure that is filled in with data type information,
|
* wxDbSqlTypeInfo is a structure that is filled in with data type information,
|
||||||
*/
|
*/
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SDWORD cbRet;
|
SQLLEN cbRet;
|
||||||
|
|
||||||
// Get information about the data type specified
|
// Get information about the data type specified
|
||||||
if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS)
|
if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS)
|
||||||
@@ -2249,7 +2249,7 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol
|
|||||||
short colNum;
|
short colNum;
|
||||||
wxChar name[DB_MAX_COLUMN_NAME_LEN+1];
|
wxChar name[DB_MAX_COLUMN_NAME_LEN+1];
|
||||||
SWORD Sword;
|
SWORD Sword;
|
||||||
SDWORD Sdword;
|
SQLLEN Sqllen;
|
||||||
wxDbColInf* pColInf = new wxDbColInf[noCols];
|
wxDbColInf* pColInf = new wxDbColInf[noCols];
|
||||||
|
|
||||||
// Fill in column information (name, datatype)
|
// 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,
|
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_NAME,
|
||||||
name, sizeof(name),
|
name, sizeof(name),
|
||||||
&Sword, &Sdword) != SQL_SUCCESS)
|
&Sword, &Sqllen) != SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
DispAllErrors(henv, hdbc, hstmt);
|
DispAllErrors(henv, hdbc, hstmt);
|
||||||
delete[] pColInf;
|
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
|
pColInf[colNum].colName[DB_MAX_COLUMN_NAME_LEN] = 0; // Prevent buffer overrun
|
||||||
|
|
||||||
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_TYPE,
|
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);
|
DispAllErrors(henv, hdbc, hstmt);
|
||||||
delete[] pColInf;
|
delete[] pColInf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Sdword)
|
switch (Sqllen)
|
||||||
{
|
{
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
#if defined(SQL_WCHAR)
|
#if defined(SQL_WCHAR)
|
||||||
@@ -2312,7 +2312,7 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol
|
|||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
default:
|
default:
|
||||||
wxString errMsg;
|
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"));
|
wxLogDebug(errMsg,wxT("ODBC DEBUG MESSAGE"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -2337,7 +2337,7 @@ bool wxDb::GetNext(void)
|
|||||||
|
|
||||||
|
|
||||||
/********** wxDb::GetData() **********/
|
/********** 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(pData);
|
||||||
wxASSERT(cbReturned);
|
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 szPkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Primary key column */
|
||||||
wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */
|
wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */
|
||||||
SQLRETURN retcode;
|
SQLRETURN retcode;
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
SWORD i;
|
SWORD i;
|
||||||
wxString tempStr;
|
wxString tempStr;
|
||||||
/*
|
/*
|
||||||
@@ -2534,7 +2534,7 @@ wxDbColInf *wxDb::GetColumns(wxChar *tableName[], const wxChar *userID)
|
|||||||
wxDbColInf *colInf = 0;
|
wxDbColInf *colInf = 0;
|
||||||
|
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
|
|
||||||
wxString TableName;
|
wxString TableName;
|
||||||
|
|
||||||
@@ -2693,7 +2693,7 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, UWORD *numCols, const wx
|
|||||||
wxDbColInf *colInf = 0;
|
wxDbColInf *colInf = 0;
|
||||||
|
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
|
|
||||||
wxString TableName;
|
wxString TableName;
|
||||||
|
|
||||||
@@ -3306,7 +3306,7 @@ wxDbInf *wxDb::GetCatalog(const wxChar *userID)
|
|||||||
int noTab = 0; // Counter while filling table entries
|
int noTab = 0; // Counter while filling table entries
|
||||||
int pass;
|
int pass;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
wxString tblNameSave;
|
wxString tblNameSave;
|
||||||
|
|
||||||
wxString UserID;
|
wxString UserID;
|
||||||
@@ -3417,7 +3417,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
|
|||||||
wxASSERT(fileName.Length());
|
wxASSERT(fileName.Length());
|
||||||
|
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
wxChar tblName[DB_MAX_TABLE_NAME_LEN+1];
|
wxChar tblName[DB_MAX_TABLE_NAME_LEN+1];
|
||||||
wxString tblNameSave;
|
wxString tblNameSave;
|
||||||
wxChar colName[DB_MAX_COLUMN_NAME_LEN+1];
|
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());
|
wxASSERT(tableName.Length());
|
||||||
|
|
||||||
wxDbTablePrivilegeInfo result;
|
wxDbTablePrivilegeInfo result;
|
||||||
SDWORD cbRetVal;
|
SQLLEN cbRetVal;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
// We probably need to be able to dynamically set this based on
|
// We probably need to be able to dynamically set this based on
|
||||||
|
@@ -560,7 +560,7 @@ bool wxDbTable::bindUpdateParams(void)
|
|||||||
/********** wxDbTable::bindCols() **********/
|
/********** wxDbTable::bindCols() **********/
|
||||||
bool wxDbTable::bindCols(HSTMT cursor)
|
bool wxDbTable::bindCols(HSTMT cursor)
|
||||||
{
|
{
|
||||||
static SDWORD cb;
|
static SQLLEN cb;
|
||||||
|
|
||||||
// Bind each column of the table to a memory address for fetching data
|
// Bind each column of the table to a memory address for fetching data
|
||||||
UWORD i;
|
UWORD i;
|
||||||
@@ -586,7 +586,7 @@ bool wxDbTable::getRec(UWORD fetchType)
|
|||||||
if (!pDb->FwdOnlyCursors())
|
if (!pDb->FwdOnlyCursors())
|
||||||
{
|
{
|
||||||
// Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType
|
// Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType
|
||||||
UDWORD cRowsFetched;
|
SQLULEN cRowsFetched;
|
||||||
UWORD rowStatus;
|
UWORD rowStatus;
|
||||||
|
|
||||||
retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &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'
|
// e.g. DELETE FROM PARTS WHERE ROWID = '111.222.333'
|
||||||
if (CanUpdateByROWID())
|
if (CanUpdateByROWID())
|
||||||
{
|
{
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
wxChar rowid[wxDB_ROWID_LEN+1];
|
wxChar rowid[wxDB_ROWID_LEN+1];
|
||||||
|
|
||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// 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'
|
// e.g. UPDATE PARTS SET Col1 = ?, Col2 = ? WHERE ROWID = '111.222.333'
|
||||||
if (CanUpdateByROWID())
|
if (CanUpdateByROWID())
|
||||||
{
|
{
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
wxChar rowid[wxDB_ROWID_LEN+1];
|
wxChar rowid[wxDB_ROWID_LEN+1];
|
||||||
|
|
||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
@@ -2431,7 +2431,7 @@ ULONG wxDbTable::Count(const wxString &args)
|
|||||||
{
|
{
|
||||||
ULONG count;
|
ULONG count;
|
||||||
wxString sqlStmt;
|
wxString sqlStmt;
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
|
|
||||||
// Build a "SELECT COUNT(*) FROM queryTableName [WHERE whereClause]" SQL Statement
|
// Build a "SELECT COUNT(*) FROM queryTableName [WHERE whereClause]" SQL Statement
|
||||||
sqlStmt = wxT("SELECT COUNT(");
|
sqlStmt = wxT("SELECT COUNT(");
|
||||||
@@ -2522,7 +2522,7 @@ bool wxDbTable::Refresh(void)
|
|||||||
|
|
||||||
if (CanUpdateByROWID())
|
if (CanUpdateByROWID())
|
||||||
{
|
{
|
||||||
SDWORD cb;
|
SQLLEN cb;
|
||||||
wxChar rowid[wxDB_ROWID_LEN+1];
|
wxChar rowid[wxDB_ROWID_LEN+1];
|
||||||
|
|
||||||
// Get the ROWID value. If not successful retreiving the ROWID,
|
// Get the ROWID value. If not successful retreiving the ROWID,
|
||||||
|
Reference in New Issue
Block a user