// 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__
#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"
#include <math.h>
#include <stdlib.h>
-#if defined(__WINDOWS__) && !defined(__WIN32__)
+#if defined(__WXMSW__) && !defined(__WIN32__)
#include <print.h>
#endif
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;
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;
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))
{
}
}
// Overridables
-void wxDatabase::OnSetOptions(wxRecordSet *recordSet)
+void wxDatabase::OnSetOptions(wxRecordSet *WXUNUSED(recordSet))
{
}
-void wxDatabase::OnWaitForDataSource(bool stillExecuting)
+void wxDatabase::OnWaitForDataSource(bool WXUNUSED(stillExecuting))
{
}
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;
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;
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)
{
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)
{
if (retcode == SQL_ERROR)
return 0.0;
else
- return atof(buf);
+ return (float)atof(buf);
}
/*
}
// 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
do {
((wxQueryCol*)node->Data())->FillVar(recnum);
- } while (node = node->Next());
+ } while ((node = node->Next()));
}
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) {
bool wxRecordSet::GetColumns(char* table)
{
char* name=NULL;
- char* wildcard = "%";
+// char* wildcard = "%";
name = table ? table : tablename;
bool wxRecordSet::GetPrimaryKeys(char* table)
{
char* name=NULL;
- char* wildcard = "%";
+// char* wildcard = "%";
name = table ? table : tablename;
{
char* Pkname=NULL;
char* Fkname=NULL;
- char* wildcard = "%";
+// char* wildcard = "%";
// Try to disable situation: both PkTableName and FkTableName are NULL
// set Pkname from tablename
((wxQueryCol*)node->Data())->SetFieldDirty(cursor, dirty);
}
-void wxRecordSet::SetFieldNull(void *p, bool isNull)
+void wxRecordSet::SetFieldNull(void *WXUNUSED(p), bool WXUNUSED(isNull))
{
}
wxNode* node = fields.Nth(row);
if (!node)
- return NULL;
+ return 0;
return ((wxQueryField*)node->Data())->GetSize();
}
{
if (data) // JACS
delete[] (char*)data;
- if (data = new char[size+1])
+ if ((data = new char[size+1]))
{
char *str = (char *)data;
int i;
{
if (data) // JACS
delete (long*)data;
- if (data = new long)
+ if ((data = new long))
*(long*)data = 0L;
break;
}
{
if (data)
delete (short*)data;
- if (data = new short)
+ if ((data = new short))
*(short*)data = 0;
break;
}
{
if (data)
delete (double*)data;
- if (data = new double)
+ if ((data = new double))
*(double*)data = 0;
break;
}
{
if (data)
delete (float*)data;
- if (data = new float)
+ if ((data = new float))
*(float*)data = (float)0;
break;
}
return dirty;
}
-#endif // USE_ODBC
+#ifdef __VISUALC__
+ #pragma warning(default:4706) // assignment within conditional expression
+#endif // VC++
+
+#endif // wxUSE_ODBC