X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c801d85f158c4cba50b588807daabdcbd0ed3853..e296ac9f3d5fb224e0717b2ff410b913905f6b5f:/src/common/odbc.cpp diff --git a/src/common/odbc.cpp b/src/common/odbc.cpp index 7335397b84..f82a986409 100644 --- a/src/common/odbc.cpp +++ b/src/common/odbc.cpp @@ -2,12 +2,12 @@ // Name: odbc.cpp // Purpose: ODBC implementation // Author: Julian Smart, Olaf Klein (oklein@smallo.ruhr.de), -// Patrick Halke (patrick@zaphod.ruhr.de) -// Modified by: +// Patrick Halke (patrick@zaphod.ruhr.de) +// Modified by: // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -23,7 +23,11 @@ #include "wx/defs.h" -#if USE_ODBC +#if wxUSE_ODBC + +#ifdef __VISUALC__ + #pragma warning(disable:4706) // assignment within conditional expression +#endif // VC++ #ifndef WX_PRECOMP #include "wx/utils.h" @@ -36,7 +40,7 @@ #include #include -#if defined(__WINDOWS__) && !defined(__WIN32__) +#if defined(__WXMSW__) && !defined(__WIN32__) #include #endif @@ -129,7 +133,8 @@ char* wxDatabase::GetErrorClass(void) { return sqlstate; } -bool wxDatabase::Open(char *thedatasource, bool exclusive, bool readOnly, char *username, char *password) +bool wxDatabase::Open(char *thedatasource, bool WXUNUSED(exclusive), + bool WXUNUSED(readOnly), char *username, char *password) { err_occured = FALSE; @@ -198,7 +203,7 @@ char *wxDatabase::GetDatabaseName(void) char nameBuf[400]; int nameSize = 0; - retcode = SQLGetInfo(hDBC, SQL_DATABASE_NAME, nameBuf, sizeof(nameBuf), (short *)&nameSize); + retcode = SQLGetInfo(hDBC, SQL_DATABASE_NAME, (unsigned char*)nameBuf, sizeof(nameBuf), (short *)&nameSize); if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) return NULL; @@ -230,15 +235,15 @@ bool wxDatabase::InWaitForDataSource(void) return FALSE; } -void wxDatabase::SetLoginTimeout(long seconds) +void wxDatabase::SetLoginTimeout(long WXUNUSED(seconds)) { } -void wxDatabase::SetQueryTimeout(long seconds) +void wxDatabase::SetQueryTimeout(long WXUNUSED(seconds)) { } -void wxDatabase::SetSynchronousMode(bool synchronous) +void wxDatabase::SetSynchronousMode(bool WXUNUSED(synchronous)) { } @@ -263,11 +268,11 @@ void wxDatabase::Cancel(void) } // Overridables -void wxDatabase::OnSetOptions(wxRecordSet *recordSet) +void wxDatabase::OnSetOptions(wxRecordSet *WXUNUSED(recordSet)) { } -void wxDatabase::OnWaitForDataSource(bool stillExecuting) +void wxDatabase::OnWaitForDataSource(bool WXUNUSED(stillExecuting)) { } @@ -335,7 +340,7 @@ void wxDatabase::ResetRecordSets(void) bool wxDatabase::GetInfo(long infoType, long *buf) { short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)infoType, (char *)buf, sizeof(buf), &sz); + retcode = SQLGetInfo(hDBC, (UWORD)infoType, (unsigned char*)buf, sizeof(buf), &sz); if (retcode != SQL_ERROR) return TRUE; @@ -349,7 +354,7 @@ bool wxDatabase::GetInfo(long infoType, char *buf, int bufSize) bufSize = sizeof(buf); short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)infoType, buf, bufSize, &sz); + retcode = SQLGetInfo(hDBC, (UWORD)infoType, (unsigned char*)buf, bufSize, &sz); if (retcode != SQL_ERROR) return TRUE; @@ -386,7 +391,7 @@ wxString wxDatabase::GetODBCVersionString(bool implementation) int bufSize = sizeof(buf); short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, buf, bufSize, &sz); + retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, (unsigned char*)buf, bufSize, &sz); if (hDBC != 0 && noDBC) { @@ -427,7 +432,7 @@ float wxDatabase::GetODBCVersionFloat(bool implementation) int bufSize = sizeof(buf); short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, buf, bufSize, &sz); + retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, (unsigned char*)buf, bufSize, &sz); if (hDBC != 0 && noDBC) { @@ -485,7 +490,7 @@ wxRecordSet::~wxRecordSet(void) } // If SQL is non-NULL, table and columns can be NULL. -bool wxRecordSet::BeginQuery(int openType, char *sql, int options) +bool wxRecordSet::BeginQuery(int WXUNUSED(openType), char *WXUNUSED(sql), int WXUNUSED(options)) { // Needs to construct an appropriate SQL statement. By default // (i.e. if table and columns are provided) then @@ -565,7 +570,7 @@ void wxRecordSet::FillVars(int recnum) { do { ((wxQueryCol*)node->Data())->FillVar(recnum); - } while (node = node->Next()); + } while ((node = node->Next())); } bool wxRecordSet::GetResultSet(void) @@ -606,14 +611,14 @@ bool wxRecordSet::GetResultSet(void) curcol = cols.Append(name, col1); col1->SetName(name); col1->SetType(type); - col1->SetNullable(nullable); + col1->SetNullable((nullable != 0)); wxQueryField *field1 = new wxQueryField; fetch = fetchbuf.Append(field1); field1->SetType(type); field1->SetSize(len); - SQLBindCol(hStmt, i+1, SQL_C_BINARY, field1->GetData(), field1->GetSize(), &trash); + SQLBindCol(hStmt, i+1, SQL_C_BINARY, (unsigned char*)field1->GetData(), field1->GetSize(), &trash); } switch (type) { @@ -796,7 +801,7 @@ bool wxRecordSet::GetTables(void) bool wxRecordSet::GetColumns(char* table) { char* name=NULL; - char* wildcard = "%"; +// char* wildcard = "%"; name = table ? table : tablename; @@ -836,7 +841,7 @@ bool wxRecordSet::GetColumns(char* table) bool wxRecordSet::GetPrimaryKeys(char* table) { char* name=NULL; - char* wildcard = "%"; +// char* wildcard = "%"; name = table ? table : tablename; @@ -875,7 +880,7 @@ bool wxRecordSet::GetForeignKeys(char* PkTableName, char * FkTableName) { char* Pkname=NULL; char* Fkname=NULL; - char* wildcard = "%"; +// char* wildcard = "%"; // Try to disable situation: both PkTableName and FkTableName are NULL // set Pkname from tablename @@ -1371,7 +1376,7 @@ void wxRecordSet::SetFieldDirty(const char* name, bool dirty) ((wxQueryCol*)node->Data())->SetFieldDirty(cursor, dirty); } -void wxRecordSet::SetFieldNull(void *p, bool isNull) +void wxRecordSet::SetFieldNull(void *WXUNUSED(p), bool WXUNUSED(isNull)) { } @@ -1534,7 +1539,7 @@ long wxQueryCol::GetSize(int row) { wxNode* node = fields.Nth(row); if (!node) - return NULL; + return 0; return ((wxQueryField*)node->Data())->GetSize(); } @@ -1599,7 +1604,7 @@ bool wxQueryField::AllocData(void) { { if (data) // JACS delete[] (char*)data; - if (data = new char[size+1]) + if ((data = new char[size+1])) { char *str = (char *)data; int i; @@ -1613,7 +1618,7 @@ bool wxQueryField::AllocData(void) { { if (data) // JACS delete (long*)data; - if (data = new long) + if ((data = new long)) *(long*)data = 0L; break; } @@ -1621,7 +1626,7 @@ bool wxQueryField::AllocData(void) { { if (data) delete (short*)data; - if (data = new short) + if ((data = new short)) *(short*)data = 0; break; } @@ -1630,7 +1635,7 @@ bool wxQueryField::AllocData(void) { { if (data) delete (double*)data; - if (data = new double) + if ((data = new double)) *(double*)data = 0; break; } @@ -1638,7 +1643,7 @@ bool wxQueryField::AllocData(void) { { if (data) delete (float*)data; - if (data = new float) + if ((data = new float)) *(float*)data = (float)0; break; } @@ -1826,4 +1831,8 @@ bool wxQueryField::IsDirty(void) { return dirty; } -#endif // USE_ODBC +#ifdef __VISUALC__ + #pragma warning(default:4706) // assignment within conditional expression +#endif // VC++ + +#endif // wxUSE_ODBC