also define SQLTCHAR for DMC++
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35517
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#define SQL_C_WXCHAR SQL_C_CHAR
#endif
#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;
typedef float SFLOAT;
typedef double SDOUBLE;
typedef unsigned int UINT;
+#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;
const int wxDB_PATH_MAX = 254;
extern WXDLLIMPEXP_DATA_ODBC(wxChar const *) SQL_LOG_FILENAME;
bool ExecSql(const wxString &pSqlStmt);
bool ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcols);
bool GetNext(void);
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);
bool Grant(int privileges, const wxString &tableName, const wxString &userList = wxT("PUBLIC"));
int TranslateSqlState(const wxString &SQLState);
wxDbInf *GetCatalog(const wxChar *userID=NULL);
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
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();
bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates
wxDbColDef();
* wxDbSqlTypeInfo is a structure that is filled in with data type information,
*/
RETCODE retcode;
* wxDbSqlTypeInfo is a structure that is filled in with data type information,
*/
RETCODE retcode;
// Get information about the data type specified
if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS)
// Get information about the data type specified
if (SQLGetTypeInfo(hstmt, fSqlType) != SQL_SUCCESS)
short colNum;
wxChar name[DB_MAX_COLUMN_NAME_LEN+1];
SWORD Sword;
short colNum;
wxChar name[DB_MAX_COLUMN_NAME_LEN+1];
SWORD Sword;
wxDbColInf* pColInf = new wxDbColInf[noCols];
// Fill in column information (name, datatype)
wxDbColInf* pColInf = new wxDbColInf[noCols];
// Fill in column information (name, datatype)
{
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_NAME,
name, sizeof(name),
{
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;
{
DispAllErrors(henv, hdbc, hstmt);
delete[] pColInf;
pColInf[colNum].colName[DB_MAX_COLUMN_NAME_LEN] = 0; // Prevent buffer overrun
if (SQLColAttributes(hstmt, (UWORD)(colNum+1), SQL_COLUMN_TYPE,
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;
}
{
DispAllErrors(henv, hdbc, hstmt);
delete[] pColInf;
return false;
}
{
#if wxUSE_UNICODE
#if defined(SQL_WCHAR)
{
#if wxUSE_UNICODE
#if defined(SQL_WCHAR)
#ifdef __WXDEBUG__
default:
wxString errMsg;
#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
}
wxLogDebug(errMsg,wxT("ODBC DEBUG MESSAGE"));
#endif
}
/********** 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(cbReturned);
{
wxASSERT(pData);
wxASSERT(cbReturned);
wxChar szPkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Primary key column */
wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */
SQLRETURN retcode;
wxChar szPkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Primary key column */
wxChar szFkCol[DB_MAX_COLUMN_NAME_LEN+1]; /* Foreign key column */
SQLRETURN retcode;
SWORD i;
wxString tempStr;
/*
SWORD i;
wxString tempStr;
/*
wxDbColInf *colInf = 0;
RETCODE retcode;
wxDbColInf *colInf = 0;
RETCODE retcode;
wxDbColInf *colInf = 0;
RETCODE retcode;
wxDbColInf *colInf = 0;
RETCODE retcode;
int noTab = 0; // Counter while filling table entries
int pass;
RETCODE retcode;
int noTab = 0; // Counter while filling table entries
int pass;
RETCODE retcode;
wxString tblNameSave;
wxString UserID;
wxString tblNameSave;
wxString UserID;
wxASSERT(fileName.Length());
RETCODE retcode;
wxASSERT(fileName.Length());
RETCODE retcode;
wxChar tblName[DB_MAX_TABLE_NAME_LEN+1];
wxString tblNameSave;
wxChar colName[DB_MAX_COLUMN_NAME_LEN+1];
wxChar tblName[DB_MAX_TABLE_NAME_LEN+1];
wxString tblNameSave;
wxChar colName[DB_MAX_COLUMN_NAME_LEN+1];
wxASSERT(tableName.Length());
wxDbTablePrivilegeInfo result;
wxASSERT(tableName.Length());
wxDbTablePrivilegeInfo result;
RETCODE retcode;
// We probably need to be able to dynamically set this based on
RETCODE retcode;
// We probably need to be able to dynamically set this based on
/********** wxDbTable::bindCols() **********/
bool wxDbTable::bindCols(HSTMT cursor)
{
/********** wxDbTable::bindCols() **********/
bool wxDbTable::bindCols(HSTMT cursor)
{
// Bind each column of the table to a memory address for fetching data
UWORD i;
// Bind each column of the table to a memory address for fetching data
UWORD i;
if (!pDb->FwdOnlyCursors())
{
// Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType
if (!pDb->FwdOnlyCursors())
{
// Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType
UWORD rowStatus;
retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus);
UWORD rowStatus;
retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus);
// e.g. DELETE FROM PARTS WHERE ROWID = '111.222.333'
if (CanUpdateByROWID())
{
// e.g. DELETE FROM PARTS WHERE ROWID = '111.222.333'
if (CanUpdateByROWID())
{
wxChar rowid[wxDB_ROWID_LEN+1];
// Get the ROWID value. If not successful retreiving the ROWID,
wxChar rowid[wxDB_ROWID_LEN+1];
// Get the ROWID value. If not successful retreiving the ROWID,
// e.g. UPDATE PARTS SET Col1 = ?, Col2 = ? WHERE ROWID = '111.222.333'
if (CanUpdateByROWID())
{
// e.g. UPDATE PARTS SET Col1 = ?, Col2 = ? WHERE ROWID = '111.222.333'
if (CanUpdateByROWID())
{
wxChar rowid[wxDB_ROWID_LEN+1];
// Get the ROWID value. If not successful retreiving the ROWID,
wxChar rowid[wxDB_ROWID_LEN+1];
// Get the ROWID value. If not successful retreiving the ROWID,
{
ULONG count;
wxString sqlStmt;
{
ULONG count;
wxString sqlStmt;
// Build a "SELECT COUNT(*) FROM queryTableName [WHERE whereClause]" SQL Statement
sqlStmt = wxT("SELECT COUNT(");
// Build a "SELECT COUNT(*) FROM queryTableName [WHERE whereClause]" SQL Statement
sqlStmt = wxT("SELECT COUNT(");
if (CanUpdateByROWID())
{
if (CanUpdateByROWID())
{
wxChar rowid[wxDB_ROWID_LEN+1];
// Get the ROWID value. If not successful retreiving the ROWID,
wxChar rowid[wxDB_ROWID_LEN+1];
// Get the ROWID value. If not successful retreiving the ROWID,