#endif //__BORLANDC__
#ifndef WX_PRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif //WX_PRECOMP
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMAC__)
#include "db.xpm"
#endif
#include <stdio.h> /* Included strictly for reading the text file with the database parameters */
-//#include <wx/db.h> /* Required in the file which will get the data source connection */
-//#include <wx/dbtable.h> /* Has the wxDbTable object from which all data objects will inherit their data table functionality */
+//#include "wx/db.h" /* Required in the file which will get the data source connection */
+//#include "wx/dbtable.h" /* Has the wxDbTable object from which all data objects will inherit their data table functionality */
//extern wxDbList WXDLLEXPORT *PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */
#if wxUSE_NEW_GRID
-#include <wx/grid.h>
-#include <wx/generic/gridctrl.h>
-#include <wx/dbgrid.h>
+#include "wx/grid.h"
+#include "wx/generic/gridctrl.h"
+#include "wx/dbgrid.h"
#define CHOICEINT
#endif
#endif
-bool DataTypeSupported(wxDb *pDb, SWORD datatype)
+bool DataTypeSupported(wxDb *pDb, SWORD datatype, wxString *nativeDataTypeName)
{
wxDbSqlTypeInfo sqlTypeInfo;
- bool breakpoint = false;
+ bool breakpoint = FALSE;
+ *nativeDataTypeName = wxEmptyString;
if (pDb->GetDataTypeInfo(datatype, sqlTypeInfo))
- breakpoint = true;
+ {
+ *nativeDataTypeName = sqlTypeInfo.TypeName;
+ breakpoint = TRUE;
+ }
return breakpoint;
void CheckSupportForAllDataTypes(wxDb *pDb)
{
+ wxString nativeDataTypeName;
+
wxLogMessage("\nThe following datatypes are supported by the\ndatabase you are currently connected to:");
#ifdef SQL_C_BINARY
- if (DataTypeSupported(pDb,SQL_C_BINARY))
- wxLogMessage("SQL_C_BINARY");
+ if (DataTypeSupported(pDb,SQL_C_BINARY, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_BINARY (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_BIT
- if (DataTypeSupported(pDb,SQL_C_BIT))
- wxLogMessage("SQL_C_BIT");
+ if (DataTypeSupported(pDb,SQL_C_BIT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_BIT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_BOOKMARK
- if (DataTypeSupported(pDb,SQL_C_BOOKMARK))
- wxLogMessage("SQL_C_BOOKMARK");
+ if (DataTypeSupported(pDb,SQL_C_BOOKMARK, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_BOOKMARK (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_CHAR
- if (DataTypeSupported(pDb,SQL_C_CHAR))
- wxLogMessage("SQL_C_CHAR");
+ if (DataTypeSupported(pDb,SQL_C_CHAR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_CHAR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_DATE
- if (DataTypeSupported(pDb,SQL_C_DATE))
- wxLogMessage("SQL_C_DATE");
+ if (DataTypeSupported(pDb,SQL_C_DATE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_DATE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_DEFAULT
- if (DataTypeSupported(pDb,SQL_C_DEFAULT))
- wxLogMessage("SQL_C_DEFAULT");
+ if (DataTypeSupported(pDb,SQL_C_DEFAULT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_DEFAULT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_DOUBLE
- if (DataTypeSupported(pDb,SQL_C_DOUBLE))
- wxLogMessage("SQL_C_DOUBLE");
+ if (DataTypeSupported(pDb,SQL_C_DOUBLE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_DOUBLE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_FLOAT
- if (DataTypeSupported(pDb,SQL_C_FLOAT))
- wxLogMessage("SQL_C_FLOAT");
+ if (DataTypeSupported(pDb,SQL_C_FLOAT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_FLOAT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_GUID
- if (DataTypeSupported(pDb,SQL_C_GUID))
- wxLogMessage("SQL_C_GUID");
+ if (DataTypeSupported(pDb,SQL_C_GUID, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_GUID (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_DAY
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY))
- wxLogMessage("SQL_C_INTERVAL_DAY");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_DAY (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_DAY_TO_HOUR
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY_TO_HOUR))
- wxLogMessage("SQL_C_INTERVAL_DAY_TO_HOUR");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY_TO_HOUR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_DAY_TO_HOUR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_DAY_TO_MINUTE
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY_TO_MINUTE))
- wxLogMessage("SQL_C_INTERVAL_DAY_TO_MINUTE");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY_TO_MINUTE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_DAY_TO_MINUTE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_DAY_TO_SECOND
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY_TO_SECOND))
- wxLogMessage("SQL_C_INTERVAL_DAY_TO_SECOND");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_DAY_TO_SECOND, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_DAY_TO_SECOND (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_HOUR
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_HOUR))
- wxLogMessage("SQL_C_INTERVAL_HOUR");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_HOUR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_HOUR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_HOUR_TO_MINUTE
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_HOUR_TO_MINUTE))
- wxLogMessage("SQL_C_INTERVAL_HOUR_TO_MINUTE");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_HOUR_TO_MINUTE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_HOUR_TO_MINUTE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_HOUR_TO_SECOND
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_HOUR_TO_SECOND))
- wxLogMessage("SQL_C_INTERVAL_HOUR_TO_SECOND");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_HOUR_TO_SECOND, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_HOUR_TO_SECOND (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_MINUTE
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_MINUTE))
- wxLogMessage("SQL_C_INTERVAL_MINUTE");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_MINUTE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_MINUTE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_MINUTE_TO_SECOND
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_MINUTE_TO_SECOND))
- wxLogMessage("SQL_C_INTERVAL_MINUTE_TO_SECOND");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_MINUTE_TO_SECOND, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_MINUTE_TO_SECOND (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_MONTH
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_MONTH))
- wxLogMessage("SQL_C_INTERVAL_MONTH");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_MONTH, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_MONTH (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_SECOND
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_SECOND))
- wxLogMessage("SQL_C_INTERVAL_SECOND");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_SECOND, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_SECOND (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_YEAR
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_YEAR))
- wxLogMessage("SQL_C_INTERVAL_YEAR");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_YEAR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_YEAR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_INTERVAL_YEAR_TO_MONTH
- if (DataTypeSupported(pDb,SQL_C_INTERVAL_YEAR_TO_MONTH))
- wxLogMessage("SQL_C_INTERVAL_YEAR_TO_MONTH");
+ if (DataTypeSupported(pDb,SQL_C_INTERVAL_YEAR_TO_MONTH, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_INTERVAL_YEAR_TO_MONTH (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_LONG
- if (DataTypeSupported(pDb,SQL_C_LONG))
- wxLogMessage("SQL_C_LONG");
+ if (DataTypeSupported(pDb,SQL_C_LONG, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_LONG (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_NUMERIC
- if (DataTypeSupported(pDb,SQL_C_NUMERIC))
- wxLogMessage("SQL_C_NUMERIC");
+ if (DataTypeSupported(pDb,SQL_C_NUMERIC, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_NUMERIC (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_SBIGINT
- if (DataTypeSupported(pDb,SQL_C_SBIGINT))
- wxLogMessage("SQL_C_SBIGINT");
+ if (DataTypeSupported(pDb,SQL_C_SBIGINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_SBIGINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_SHORT
- if (DataTypeSupported(pDb,SQL_C_SHORT))
- wxLogMessage("SQL_C_SHORT");
+ if (DataTypeSupported(pDb,SQL_C_SHORT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_SHORT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_SLONG
- if (DataTypeSupported(pDb,SQL_C_SLONG))
- wxLogMessage("SQL_C_SLONG");
+ if (DataTypeSupported(pDb,SQL_C_SLONG, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_SLONG (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_SSHORT
- if (DataTypeSupported(pDb,SQL_C_SSHORT))
- wxLogMessage("SQL_C_SSHORT");
+ if (DataTypeSupported(pDb,SQL_C_SSHORT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_SSHORT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_STINYINT
- if (DataTypeSupported(pDb,SQL_C_STINYINT))
- wxLogMessage("SQL_C_STINYINT");
+ if (DataTypeSupported(pDb,SQL_C_STINYINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_STINYINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_TIME
- if (DataTypeSupported(pDb,SQL_C_TIME))
- wxLogMessage("SQL_C_TIME");
+ if (DataTypeSupported(pDb,SQL_C_TIME, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TIME (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_TIMESTAMP
- if (DataTypeSupported(pDb,SQL_C_TIMESTAMP))
- wxLogMessage("SQL_C_TIMESTAMP");
+ if (DataTypeSupported(pDb,SQL_C_TIMESTAMP, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TIMESTAMP (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_TINYINT
- if (DataTypeSupported(pDb,SQL_C_TINYINT))
- wxLogMessage("SQL_C_TINYINT");
+ if (DataTypeSupported(pDb,SQL_C_TINYINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TINYINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_TYPE_DATE
- if (DataTypeSupported(pDb,SQL_C_TYPE_DATE))
- wxLogMessage("SQL_C_TYPE_DATE");
+ if (DataTypeSupported(pDb,SQL_C_TYPE_DATE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TYPE_DATE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_TYPE_TIME
- if (DataTypeSupported(pDb,SQL_C_TYPE_TIME))
- wxLogMessage("SQL_C_TYPE_TIME");
+ if (DataTypeSupported(pDb,SQL_C_TYPE_TIME, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TYPE_TIME (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_TYPE_TIMESTAMP
- if (DataTypeSupported(pDb,SQL_C_TYPE_TIMESTAMP))
- wxLogMessage("SQL_C_TYPE_TIMESTAMP");
+ if (DataTypeSupported(pDb,SQL_C_TYPE_TIMESTAMP, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TYPE_TIMESTAMP (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_UBIGINT
- if (DataTypeSupported(pDb,SQL_C_UBIGINT))
- wxLogMessage("SQL_C_UBIGINT");
+ if (DataTypeSupported(pDb,SQL_C_UBIGINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_UBIGINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_ULONG
- if (DataTypeSupported(pDb,SQL_C_ULONG))
- wxLogMessage("SQL_C_ULONG");
+ if (DataTypeSupported(pDb,SQL_C_ULONG, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_ULONG (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_USHORT
- if (DataTypeSupported(pDb,SQL_C_USHORT))
- wxLogMessage("SQL_C_USHORT");
+ if (DataTypeSupported(pDb,SQL_C_USHORT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_USHORT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_UTINYINT
- if (DataTypeSupported(pDb,SQL_C_UTINYINT))
- wxLogMessage("SQL_C_UTINYINT");
+ if (DataTypeSupported(pDb,SQL_C_UTINYINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_UTINYINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_C_VARBOOKMARK
- if (DataTypeSupported(pDb,SQL_C_VARBOOKMARK))
- wxLogMessage("SQL_C_VARBOOKMARK");
+ if (DataTypeSupported(pDb,SQL_C_VARBOOKMARK, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_VARBOOKMARK (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
// Extended SQL types
#ifdef SQL_DATE
- if (DataTypeSupported(pDb,SQL_DATE))
- wxLogMessage("SQL_DATE");
+ if (DataTypeSupported(pDb,SQL_DATE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_DATE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_INTERVAL
- if (DataTypeSupported(pDb,SQL_INTERVAL))
- wxLogMessage("SQL_INTERVAL");
+ if (DataTypeSupported(pDb,SQL_INTERVAL, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_INTERVAL (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_TIME
- if (DataTypeSupported(pDb,SQL_TIME))
- wxLogMessage("SQL_TIME");
+ if (DataTypeSupported(pDb,SQL_TIME, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_TIME (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_TIMESTAMP
- if (DataTypeSupported(pDb,SQL_TIMESTAMP))
- wxLogMessage("SQL_TIMESTAMP");
+ if (DataTypeSupported(pDb,SQL_TIMESTAMP, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_TIMESTAMP (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_LONGVARCHAR
- if (DataTypeSupported(pDb,SQL_LONGVARCHAR))
- wxLogMessage("SQL_LONGVARCHAR");
+ if (DataTypeSupported(pDb,SQL_LONGVARCHAR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_LONGVARCHAR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_BINARY
- if (DataTypeSupported(pDb,SQL_BINARY))
- wxLogMessage("SQL_BINARY");
+ if (DataTypeSupported(pDb,SQL_BINARY, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_BINARY (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_VARBINARY
- if (DataTypeSupported(pDb,SQL_VARBINARY))
- wxLogMessage("SQL_VARBINARY");
+ if (DataTypeSupported(pDb,SQL_VARBINARY, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_VARBINARY (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_LONGVARBINARY
- if (DataTypeSupported(pDb,SQL_LONGVARBINARY))
- wxLogMessage("SQL_LONGVARBINARY");
+ if (DataTypeSupported(pDb,SQL_LONGVARBINARY, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_LOGVARBINARY (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_BIGINT
- if (DataTypeSupported(pDb,SQL_BIGINT))
- wxLogMessage("SQL_BIGINT");
+ if (DataTypeSupported(pDb,SQL_BIGINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_BIGINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_TINYINT
- if (DataTypeSupported(pDb,SQL_TINYINT))
- wxLogMessage("SQL_TINYINT");
+ if (DataTypeSupported(pDb,SQL_TINYINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_TINYINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_BIT
- if (DataTypeSupported(pDb,SQL_BIT))
- wxLogMessage("SQL_BIT");
+ if (DataTypeSupported(pDb,SQL_BIT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_BIT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_GUID
- if (DataTypeSupported(pDb,SQL_GUID))
- wxLogMessage("SQL_GUID");
+ if (DataTypeSupported(pDb,SQL_GUID, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_GUID (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_CHAR
- if (DataTypeSupported(pDb,SQL_CHAR))
- wxLogMessage("SQL_CHAR");
+ if (DataTypeSupported(pDb,SQL_CHAR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_CHAR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_INTEGER
- if (DataTypeSupported(pDb,SQL_INTEGER))
- wxLogMessage("SQL_INTEGER");
+ if (DataTypeSupported(pDb,SQL_INTEGER, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_INTEGER (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_SMALLINT
- if (DataTypeSupported(pDb,SQL_SMALLINT))
- wxLogMessage("SQL_SMALLINT");
+ if (DataTypeSupported(pDb,SQL_SMALLINT, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_SAMLLINT (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_REAL
- if (DataTypeSupported(pDb,SQL_REAL))
- wxLogMessage("SQL_REAL");
+ if (DataTypeSupported(pDb,SQL_REAL, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_REAL (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_DOUBLE
- if (DataTypeSupported(pDb,SQL_DOUBLE))
- wxLogMessage("SQL_DOUBLE");
+ if (DataTypeSupported(pDb,SQL_DOUBLE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_DOUBLE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_NUMERIC
- if (DataTypeSupported(pDb,SQL_NUMERIC))
- wxLogMessage("SQL_NUMERIC");
+ if (DataTypeSupported(pDb,SQL_NUMERIC, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_NUMERIC (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_DATE
- if (DataTypeSupported(pDb,SQL_DATE))
- wxLogMessage("SQL_DATE");
+ if (DataTypeSupported(pDb,SQL_DATE, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_DATE (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_TIME
- if (DataTypeSupported(pDb,SQL_TIME))
- wxLogMessage("SQL_TIME");
+ if (DataTypeSupported(pDb,SQL_TIME, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_TIME (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_TIMESTAMP
- if (DataTypeSupported(pDb,SQL_TIMESTAMP))
- wxLogMessage("SQL_TIMESTAMP");
+ if (DataTypeSupported(pDb,SQL_TIMESTAMP, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_TIMESTAMP (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
#ifdef SQL_VARCHAR
- if (DataTypeSupported(pDb,SQL_VARCHAR))
- wxLogMessage("SQL_VARCHAR");
+ if (DataTypeSupported(pDb,SQL_VARCHAR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_VARCHAR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
// UNICODE
#ifdef SQL_C_TCHAR
- if (DataTypeSupported(pDb,SQL_C_TCHAR))
- wxLogMessage("SQL_C_TCHAR (Unicode support is possible)");
+ if (DataTypeSupported(pDb,SQL_C_TCHAR, &nativeDataTypeName))
+ {
+ nativeDataTypeName = "SQL_C_TCHAR (" + nativeDataTypeName;
+ nativeDataTypeName += ")";
+ wxLogMessage(nativeDataTypeName);
+ }
#endif
wxLogMessage("\n");
params.DirPath[0] = 0;
// Show the frame
- DemoFrame->Show(true);
+ DemoFrame->Show(TRUE);
// Passing NULL for the SQL environment handle causes
// the wxDbConnectInf constructor to obtain a handle
if (!wxStrlen(params.ODBCSource))
{
wxDELETE(DbConnectInf);
- return(false);
+ return(FALSE);
}
DbConnectInf->SetDsn(params.ODBCSource);
DemoFrame->BuildParameterDialog(NULL);
wxDELETE(DbConnectInf);
wxMessageBox(wxT("Now exiting program.\n\nRestart program to try any new settings."),wxT("Notice..."),wxOK | wxICON_INFORMATION);
- return(false);
+ return(FALSE);
}
DemoFrame->BuildEditorDialog();
// Show the frame
DemoFrame->Refresh();
- return true;
+ return TRUE;
} // DatabaseDemoApp::OnInit()
+/*
+* Remove CR or CR/LF from a character string.
+*/
+char* wxRemoveLineTerminator(char* aString)
+{
+ int len = strlen(aString);
+ while (len > 0 && (aString[len-1] == '\r' || aString[len-1] == '\n')) {
+ aString[len-1] = '\0';
+ len--;
+ }
+ return aString;
+}
+
+
bool DatabaseDemoApp::ReadParamFile(Cparameters ¶ms)
{
FILE *paramFile;
tStr.Printf(wxT("Unable to open the parameter file '%s' for reading.\n\nYou must specify the data source, user name, and\npassword that will be used and save those settings."),PARAM_FILENAME);
wxMessageBox(tStr,wxT("File I/O Error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
wxChar buffer[1000+1];
fgets(buffer, sizeof(params.ODBCSource), paramFile);
- buffer[wxStrlen(buffer)-1] = wxT('\0');
+ wxRemoveLineTerminator(buffer);
wxStrcpy(params.ODBCSource,buffer);
fgets(buffer, sizeof(params.UserName), paramFile);
- buffer[wxStrlen(buffer)-1] = wxT('\0');
+ wxRemoveLineTerminator(buffer);
wxStrcpy(params.UserName,buffer);
fgets(buffer, sizeof(params.Password), paramFile);
- buffer[wxStrlen(buffer)-1] = wxT('\0');
+ wxRemoveLineTerminator(buffer);
wxStrcpy(params.Password,buffer);
fgets(buffer, sizeof(params.DirPath), paramFile);
- buffer[wxStrlen(buffer)-1] = wxT('\0');
+ wxRemoveLineTerminator(buffer);
wxStrcpy(params.DirPath,buffer);
fclose(paramFile);
- return true;
+ return TRUE;
} // DatabaseDemoApp::ReadParamFile()
wxString tStr;
tStr.Printf(wxT("Unable to write/overwrite '%s'."),PARAM_FILENAME);
wxMessageBox(tStr,wxT("File I/O Error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
fputs(wxGetApp().params.ODBCSource, paramFile);
fputc(wxT('\n'), paramFile);
fclose(paramFile);
- return true;
+ return TRUE;
} // DatabaseDemoApp::WriteParamFile()
void DatabaseDemoApp::CreateDataTable(bool recreate)
{
- bool Ok = true;
+ bool Ok = TRUE;
if (recreate)
Ok = (wxMessageBox(wxT("Any data currently residing in the table will be erased.\n\nAre you sure?"),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES);
wxBeginBusyCursor();
- bool success = true;
+ bool success = TRUE;
Contact->GetDb()->RollbackTrans(); // Make sure the current cursor is in a known/stable state
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),Contact->GetDb(),__FILE__,__LINE__),
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
- success = false;
+ success = FALSE;
}
else
{
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),Contact->GetDb(),__FILE__,__LINE__),
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
- success = false;
+ success = FALSE;
}
}
while (wxIsBusy())
void DatabaseDemoFrame::OnCreate(wxCommandEvent& event)
{
- wxGetApp().CreateDataTable(false);
+ wxGetApp().CreateDataTable(FALSE);
} // DatabaseDemoFrame::OnCreate()
void DatabaseDemoFrame::OnRecreateTable(wxCommandEvent& event)
{
- wxGetApp().CreateDataTable(true);
+ wxGetApp().CreateDataTable(TRUE);
} // DatabaseDemoFrame::OnRecreate()
{
wxGetApp().Contact->GetDb()->RollbackTrans(); // Make sure the current cursor is in a known/stable state
- if (!wxGetApp().Contact->CreateIndexes(true))
+ if (!wxGetApp().Contact->CreateIndexes(TRUE))
{
while (wxIsBusy())
wxEndBusyCursor();
JoinDate.second = 0;
JoinDate.fraction = 0;
NativeLanguage = langENGLISH;
- IsDeveloper = false;
+ IsDeveloper = FALSE;
Contributions = 0;
LinesOfCode = 0L;
} // Ccontact::Initialize
{
// NOTE: Columns now are 8 character names, as that is all dBase can support. Longer
// names can be used for other database engines
- SetColDefs ( 0,wxT("NAME"), DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), true, true); // Primary index
- SetColDefs ( 1,wxT("ADDRESS1"), DB_DATA_TYPE_VARCHAR, Addr1, SQL_C_CHAR, sizeof(Addr1), false,true);
- SetColDefs ( 2,wxT("ADDRESS2"), DB_DATA_TYPE_VARCHAR, Addr2, SQL_C_CHAR, sizeof(Addr2), false,true);
- SetColDefs ( 3,wxT("CITY"), DB_DATA_TYPE_VARCHAR, City, SQL_C_CHAR, sizeof(City), false,true);
- SetColDefs ( 4,wxT("STATE"), DB_DATA_TYPE_VARCHAR, State, SQL_C_CHAR, sizeof(State), false,true);
- SetColDefs ( 5,wxT("POSTCODE"), DB_DATA_TYPE_VARCHAR, PostalCode, SQL_C_CHAR, sizeof(PostalCode), false,true);
- SetColDefs ( 6,wxT("COUNTRY"), DB_DATA_TYPE_VARCHAR, Country, SQL_C_CHAR, sizeof(Country), false,true);
- SetColDefs ( 7,wxT("JOINDATE"), DB_DATA_TYPE_DATE, &JoinDate, SQL_C_TIMESTAMP, sizeof(JoinDate), false,true);
- SetColDefs ( 8,wxT("IS_DEV"), DB_DATA_TYPE_INTEGER, &IsDeveloper, SQL_C_BOOLEAN(IsDeveloper), sizeof(IsDeveloper), false,true);
- SetColDefs ( 9,wxT("CONTRIBS"), DB_DATA_TYPE_INTEGER, &Contributions, SQL_C_UTINYINT, sizeof(Contributions), false,true);
- SetColDefs (10,wxT("LINE_CNT"), DB_DATA_TYPE_INTEGER, &LinesOfCode, SQL_C_ULONG, sizeof(LinesOfCode), false,true);
- SetColDefs (11,wxT("LANGUAGE"), DB_DATA_TYPE_INTEGER, &NativeLanguage, SQL_C_ENUM, sizeof(NativeLanguage), false,true);
+ SetColDefs ( 0,wxT("NAME"), DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
+ SetColDefs ( 1,wxT("ADDRESS1"), DB_DATA_TYPE_VARCHAR, Addr1, SQL_C_CHAR, sizeof(Addr1), FALSE,TRUE);
+ SetColDefs ( 2,wxT("ADDRESS2"), DB_DATA_TYPE_VARCHAR, Addr2, SQL_C_CHAR, sizeof(Addr2), FALSE,TRUE);
+ SetColDefs ( 3,wxT("CITY"), DB_DATA_TYPE_VARCHAR, City, SQL_C_CHAR, sizeof(City), FALSE,TRUE);
+ SetColDefs ( 4,wxT("STATE"), DB_DATA_TYPE_VARCHAR, State, SQL_C_CHAR, sizeof(State), FALSE,TRUE);
+ SetColDefs ( 5,wxT("POSTCODE"), DB_DATA_TYPE_VARCHAR, PostalCode, SQL_C_CHAR, sizeof(PostalCode), FALSE,TRUE);
+ SetColDefs ( 6,wxT("COUNTRY"), DB_DATA_TYPE_VARCHAR, Country, SQL_C_CHAR, sizeof(Country), FALSE,TRUE);
+ SetColDefs ( 7,wxT("JOINDATE"), DB_DATA_TYPE_DATE, &JoinDate, SQL_C_TIMESTAMP, sizeof(JoinDate), FALSE,TRUE);
+ SetColDefs ( 8,wxT("IS_DEV"), DB_DATA_TYPE_INTEGER, &IsDeveloper, SQL_C_BOOLEAN(IsDeveloper), sizeof(IsDeveloper), FALSE,TRUE);
+ SetColDefs ( 9,wxT("CONTRIBS"), DB_DATA_TYPE_INTEGER, &Contributions, SQL_C_UTINYINT, sizeof(Contributions), FALSE,TRUE);
+ SetColDefs (10,wxT("LINE_CNT"), DB_DATA_TYPE_INTEGER, &LinesOfCode, SQL_C_ULONG, sizeof(LinesOfCode), FALSE,TRUE);
+ SetColDefs (11,wxT("LANGUAGE"), DB_DATA_TYPE_INTEGER, &NativeLanguage, SQL_C_ENUM, sizeof(NativeLanguage), FALSE,TRUE);
#if wxODBC_BLOB_EXPERIMENT > 0
- SetColDefs (12,wxT("PICTURE"), DB_DATA_TYPE_BLOB, Picture, SQL_LONGVARBINARY, sizeof(Picture), false,true);
+ SetColDefs (12,wxT("PICTURE"), DB_DATA_TYPE_BLOB, Picture, SQL_C_BINARY, sizeof(Picture), FALSE,TRUE);
#endif
} // Ccontact::SetupColumns
wxString indexName;
wxDbIdxDef idxDef[2];
- bool Ok = true;
+ bool Ok = TRUE;
wxStrcpy(idxDef[0].ColName, "IS_DEV");
- idxDef[0].Ascending = true;
+ idxDef[0].Ascending = TRUE;
wxStrcpy(idxDef[1].ColName, "NAME");
- idxDef[1].Ascending = true;
+ idxDef[1].Ascending = TRUE;
indexName = GetTableName();
indexName += "_IDX1";
- Ok = CreateIndex(indexName.c_str(), true, 2, idxDef, recreate);
+ Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef, recreate);
return Ok;
} // Ccontact::CreateIndexes()
SetOrderByClause(wxT(""));
if (!Query())
- return(false);
+ return(FALSE);
// Fetch the record
return(GetNext());
// Since the ::OnCommand() function is overridden, this prevents the widget
// detection in ::OnCommand() until all widgets have been initialized to prevent
// uninitialized pointers from crashing the program
- widgetPtrsSet = false;
+ widgetPtrsSet = FALSE;
- initialized = false;
+ initialized = FALSE;
SetMode(mView);
- Show(false);
+ Show(FALSE);
} // CeditorDlg constructor
if (!wxGetApp().Contact->GetNext())
wxGetApp().Contact->Initialize();
PutData();
- pResetBtn->Enable(false);
+ pResetBtn->Enable(FALSE);
return;
} // Reset button
/* wxChar *orderBy */ wxT("NAME"),
/* wxDb *pDb */ wxGetApp().READONLY_DB,
/* const wxString &defDir */ wxGetApp().DbConnectInf->GetDefaultDir(),
- /* bool distinctValues */ true);
+ /* bool distinctValues */ TRUE);
if (ListDB_Selection && wxStrlen(ListDB_Selection))
{
if (!wxGetApp().Contact)
{
wxMessageBox(wxT("Unable to instantiate an instance of Ccontact"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
// Check if the table exists or not. If it doesn't, ask the user if they want to
if (!createTable)
{
// Close();
- return false;
+ return FALSE;
}
else
- wxGetApp().CreateDataTable(false);
+ wxGetApp().CreateDataTable(FALSE);
}
// Tables must be "opened" before anything other than creating/deleting table can be done
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
}
- return false;
+ return FALSE;
}
// Build the dialog
// Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to
// handle all widget processing
- widgetPtrsSet = true;
+ widgetPtrsSet = TRUE;
// Setup the orderBy and where clauses to return back a single record as the result set,
// as there will only be one record being shown on the dialog at a time, this optimizes
wxGetApp().Contact->SetWhereClause(wxT(""));
// Perform the Query to get the result set.
- // NOTE: If there are no rows returned, that is a valid result, so Query() would return true.
- // Only if there is a database error will Query() come back as false
+ // NOTE: If there are no rows returned, that is a valid result, so Query() would return TRUE.
+ // Only if there is a database error will Query() come back as FALSE
if (!wxGetApp().Contact->Query())
{
wxString tStr;
tStr = wxT("ODBC error during Query()\n\n");
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
// Since Query succeeded, now get the row that was returned
SetMode(mView);
PutData();
- Show(true);
+ Show(TRUE);
- initialized = true;
- return true;
+ initialized = TRUE;
+ return TRUE;
} // CeditorDlg::Initialize()
void CeditorDlg::SetMode(enum DialogModes m)
{
- bool edit = false;
+ bool edit = FALSE;
mode = m;
switch (mode)
{
case mCreate:
case mEdit:
- edit = true;
+ edit = TRUE;
break;
case mView:
case mSearch:
- edit = false;
+ edit = FALSE;
break;
default:
break;
pDeveloperRadio->SetSelection(wxGetApp().Contact->IsDeveloper);
- return true;
+ return TRUE;
} // Ceditor::PutData()
* Reads the data out of all the widgets on the dialog. Some data evaluation is done
* to ensure that there is a name entered and that the date field is valid.
*
- * A return value of true means that valid data was retrieved from the dialog, otherwise
+ * A return value of TRUE means that valid data was retrieved from the dialog, otherwise
* invalid data was found (and a message was displayed telling the user what to fix), and
* the data was not placed into the appropraite fields of Ccontact
*/
if (!wxStrcmp((const wxChar*) tStr,wxT("")))
{
wxMessageBox(wxT("A name is required for entry into the contact table"),wxT("Notice..."),wxOK | wxICON_INFORMATION);
- return false;
+ return FALSE;
}
- bool invalid = false;
- int mm,dd,yyyy;
+ bool invalid = FALSE;
+ int mm = 1,dd = 1,yyyy = 2001;
int first, second;
tStr = pJoinDateTxt->GetValue();
if (tStr.Freq(wxT('/')) != 2)
- invalid = true;
+ invalid = TRUE;
// Find the month, day, and year tokens
if (!invalid)
// Force Year 2000 compliance
if (!invalid && (yyyy < 1000))
- invalid = true;
+ invalid = TRUE;
// Check the token ranges for validity
if (!invalid)
{
if (yyyy > 9999)
- invalid = true;
+ invalid = TRUE;
else if ((mm < 1) || (mm > 12))
- invalid = true;
+ invalid = TRUE;
else
{
if (dd < 1)
- invalid = true;
+ invalid = TRUE;
else
{
int days[12] = {31,28,31,30,31,30,
31,31,30,31,30,31};
if (dd > days[mm-1])
{
- invalid = true;
+ invalid = TRUE;
if ((dd == 29) && (mm == 2))
{
if (((yyyy % 4) == 0) && (((yyyy % 100) != 0) || ((yyyy % 400) == 0)))
- invalid = false;
+ invalid = FALSE;
}
}
}
else
{
wxMessageBox(wxT("Improper date format. Please check the date\nspecified and try again.\n\nNOTE: Dates are in american format (MM/DD/YYYY)"),wxT("Notice..."),wxOK | wxICON_INFORMATION);
- return false;
+ return FALSE;
}
tStr = pNameTxt->GetValue();
wxGetApp().Contact->NativeLanguage = (enum Language) pNativeLangChoice->GetSelection();
wxGetApp().Contact->IsDeveloper = pDeveloperRadio->GetSelection() > 0;
- return true;
+ return TRUE;
} // CeditorDlg::GetData()
* try to insert/update the data to the table based on the current 'mode' the dialog
* is set to.
*
- * A return value of true means the insert/update was completed successfully, a return
- * value of false means that Save() failed. If returning false, then this function
+ * A return value of TRUE means the insert/update was completed successfully, a return
+ * value of FALSE means that Save() failed. If returning FALSE, then this function
* has displayed a detailed error message for the user.
*/
bool CeditorDlg::Save()
{
- bool failed = false;
+ bool failed = FALSE;
// Read the data in the widgets of the dialog to get the user's data
if (!GetData())
- failed = true;
+ failed = TRUE;
// Perform any other required validations necessary before saving
if (!failed)
tStr = wxT("Database update failed\n\n");
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
- failed = true;
+ failed = TRUE;
}
}
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
- return(false);
+ return(FALSE);
}
if (wxGetApp().Contact->GetNext())
{
PutData();
- return(true);
+ return(TRUE);
}
else
- return(false);
+ return(FALSE);
} // CeditorDlg::GetRec()
// Since the ::OnCommand() function is overridden, this prevents the widget
// detection in ::OnCommand() until all widgets have been initialized to prevent
// uninitialized pointers from crashing the program
- widgetPtrsSet = false;
+ widgetPtrsSet = FALSE;
pParamODBCSourceMsg = new wxStaticText(this, PARAMETER_DIALOG_SOURCE_MSG, wxT("ODBC data sources:"), wxPoint( 10, 10), wxSize( -1, -1), 0, wxT("ParamODBCSourceMsg"));
pParamODBCSourceList = new wxListBox(this, PARAMETER_DIALOG_SOURCE_LISTBOX, wxPoint( 10, 29), wxSize(285, 150), 0, 0, wxLB_SINGLE|wxLB_ALWAYS_SB, wxDefaultValidator, wxT("ParamODBCSourceList"));
// Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to
// handle all widget processing
- widgetPtrsSet = true;
+ widgetPtrsSet = TRUE;
- saved = false;
+ saved = FALSE;
savedParamSettings = wxGetApp().params;
Centre(wxBOTH);
while (wxIsBusy())
wxEndBusyCursor();
- Show(false);
+ Show(FALSE);
SetReturnCode(0); // added so BoundsChecker would not report use of uninitialized variable
this->Destroy();
if (GetParent() != NULL) // The parameter dialog was not called during startup due to a missing cfg file
tStr += wxT("\nNew parameters will take effect the next time the program is started.");
wxMessageBox(tStr,wxT("Notice..."),wxOK | wxICON_INFORMATION);
- saved = true;
+ saved = TRUE;
Close();
}
return;
// Fill in the fields from the params object
if (wxGetApp().params.ODBCSource && wxStrlen(wxGetApp().params.ODBCSource))
- pParamODBCSourceList->SetStringSelection(wxGetApp().params.ODBCSource);
+ {
+ int index = pParamODBCSourceList->FindString(wxGetApp().params.ODBCSource);
+ if (index != -1)
+ pParamODBCSourceList->SetSelection(index);
+ }
pParamUserNameTxt->SetValue(wxGetApp().params.UserName);
pParamPasswordTxt->SetValue(wxGetApp().params.Password);
pParamDirPathTxt->SetValue(wxGetApp().params.DirPath);
- return true;
+ return TRUE;
} // CparameterDlg::PutData()
wxString errmsg;
errmsg.Printf(wxT("ODBC Data source name is longer than the data structure to hold it.\n'Cparameter.ODBCSource' must have a larger character array\nto handle a data source with this long of a name\n\nThe data source currently selected is %d characters long."),tStr.Length());
wxMessageBox(errmsg,wxT("Internal program error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
wxStrcpy(wxGetApp().params.ODBCSource, tStr);
}
else
- return false;
+ return FALSE;
tStr = pParamUserNameTxt->GetValue();
if (tStr.Length() > (sizeof(wxGetApp().params.UserName)-1))
wxString errmsg;
errmsg.Printf(wxT("User name is longer than the data structure to hold it.\n'Cparameter.UserName' must have a larger character array\nto handle a data source with this long of a name\n\nThe user name currently specified is %d characters long."),tStr.Length());
wxMessageBox(errmsg,wxT("Internal program error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
wxStrcpy(wxGetApp().params.UserName, tStr);
wxString errmsg;
errmsg.Printf(wxT("Password is longer than the data structure to hold it.\n'Cparameter.Password' must have a larger character array\nto handle a data source with this long of a name\n\nThe password currently specified is %d characters long."),tStr.Length());
wxMessageBox(errmsg,wxT("Internal program error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
wxStrcpy(wxGetApp().params.Password,tStr);
wxString errmsg;
errmsg.Printf(wxT("DirPath is longer than the data structure to hold it.\n'Cparameter.DirPath' must have a larger character array\nto handle a data source with this long of a name\n\nThe password currently specified is %d characters long."),tStr.Length());
wxMessageBox(errmsg,wxT("Internal program error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
wxStrcpy(wxGetApp().params.DirPath,tStr);
- return true;
+ return TRUE;
} // CparameterDlg::GetData()
if (!GetData())
{
wxGetApp().params = savedParamSettings;
- return false;
+ return FALSE;
}
wxGetApp().WriteParamFile(wxGetApp().params);
- return true;
+ return TRUE;
} // CparameterDlg::Save()
colInf = 0;
dbTable = 0;
masterTableName = tblName[0];
- widgetPtrsSet = false;
+ widgetPtrsSet = FALSE;
pDB = pDb;
// Initialize the WHERE clause from the string passed in
pQueryHintGrp = new wxStaticBox(this, QUERY_DIALOG_HINT_GROUP, wxT(""), wxPoint( 10, 291), wxSize(377, 40), 0, wxT("QueryHintGrp"));
pQueryHintMsg = new wxStaticText(this, QUERY_DIALOG_HINT_MSG, wxT(""), wxPoint( 16, 306), wxSize( -1, -1), 0, wxT("QueryHintMsg"));
- widgetPtrsSet = true;
+ widgetPtrsSet = TRUE;
// Initialize the dialog
wxString qualName;
pQueryCol2Choice->Append(wxT("VALUE -->"));
pQueryCol2Choice->SetSelection(0);
pQueryOperatorChoice->SetSelection(0);
- pQueryValue2Msg->Show(false);
- pQueryValue2Txt->Show(false);
+ pQueryValue2Msg->Show(FALSE);
+ pQueryValue2Txt->Show(FALSE);
pQueryHintMsg->SetLabel(langQRY_EQ);
}
// Hide the value2 widget
- pQueryValue2Msg->Show(false); // BETWEEN will show this widget
- pQueryValue2Txt->Show(false); // BETWEEN will show this widget
+ pQueryValue2Msg->Show(FALSE); // BETWEEN will show this widget
+ pQueryValue2Txt->Show(FALSE); // BETWEEN will show this widget
// Disable the NOT operator for <, <=, >, >=
switch((qryOp) pQueryOperatorChoice->GetSelection())
case qryOpLE:
case qryOpGE:
pQueryNotCheck->SetValue(0);
- pQueryNotCheck->Enable(false);
+ pQueryNotCheck->Enable(FALSE);
break;
default:
- pQueryNotCheck->Enable(true);
+ pQueryNotCheck->Enable(TRUE);
break;
}
case qryOpGT:
case qryOpLE:
case qryOpGE:
- pQueryCol2Choice->Enable(true);
+ pQueryCol2Choice->Enable(TRUE);
if (pQueryCol2Choice->GetSelection()) // Column name is highlighted
{
- pQueryValue1Msg->Show(false);
- pQueryValue1Txt->Show(false);
+ pQueryValue1Msg->Show(FALSE);
+ pQueryValue1Txt->Show(FALSE);
}
else // "Value" is highlighted
{
- pQueryValue1Msg->Show(true);
- pQueryValue1Txt->Show(true);
+ pQueryValue1Msg->Show(TRUE);
+ pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus();
}
break;
case qryOpCONTAINS:
case qryOpLIKE:
pQueryCol2Choice->SetSelection(0);
- pQueryCol2Choice->Enable(false);
- pQueryValue1Msg->Show(true);
- pQueryValue1Txt->Show(true);
+ pQueryCol2Choice->Enable(FALSE);
+ pQueryValue1Msg->Show(TRUE);
+ pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus();
break;
case qryOpBETWEEN:
pQueryCol2Choice->SetSelection(0);
- pQueryCol2Choice->Enable(false);
- pQueryValue2Msg->Show(true);
- pQueryValue2Txt->Show(true);
- pQueryValue1Msg->Show(true);
- pQueryValue1Txt->Show(true);
+ pQueryCol2Choice->Enable(FALSE);
+ pQueryValue2Msg->Show(TRUE);
+ pQueryValue2Txt->Show(TRUE);
+ pQueryValue1Msg->Show(TRUE);
+ pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus();
break;
}
{
if (pQueryCol2Choice->GetSelection()) // Column name is highlighted
{
- pQueryValue1Msg->Show(false);
- pQueryValue1Txt->Show(false);
+ pQueryValue1Msg->Show(FALSE);
+ pQueryValue1Txt->Show(FALSE);
}
else // "Value" is highlighted
{
- pQueryValue1Msg->Show(true);
- pQueryValue1Txt->Show(true);
+ pQueryValue1Msg->Show(TRUE);
+ pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus();
}
return;
while (wxIsBusy())
wxEndBusyCursor();
- Show(false);
+ Show(FALSE);
SetReturnCode(1); // added so BoundsChecker would not report use of uninitialized variable
this->Destroy();
int col1Idx = pQueryCol1Choice->GetSelection();
- bool quote = false;
+ bool quote = FALSE;
if (colInf[col1Idx].sqlDataType == SQL_VARCHAR ||
oper == qryOpBEGINS ||
oper == qryOpCONTAINS ||
oper == qryOpLIKE)
- quote = true;
+ quote = TRUE;
if (pQueryCol2Choice->GetSelection()) // Column name
s += pQueryCol2Choice->GetStringSelection();
if (where.Freq(wxT('(')) != where.Freq(wxT(')')))
{
wxMessageBox(wxT("There are mismatched parenthesis in the constructed where clause"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
- return(false);
+ return(FALSE);
}
// After a wxMessageBox, the focus does not necessarily return to the
// window which was the focus when the message box popped up, so return
// focus to the Query dialog for certain
SetFocus();
- return(true);
+ return(TRUE);
} // CqueryDlg::ValidateWhereClause()
void DisplayDbDiagnostics(wxDb *pDb)
{
wxString s, t;
- bool comma = false;
+ bool comma = FALSE;
s = langDBINF_DB_NAME;
s += pDb->dbInf.dbmsName;
}
s += "\n";
- comma = false;
+#ifdef __VMS__
+#pragma message disable incboodep
+#endif
+ comma = FALSE;
s += langDBINF_TXN_ISOLATION_OPTS;
if (pDb->dbInf.txnIsolationOptions & SQL_TXN_READ_UNCOMMITTED)
{s += langDBINF_READ_UNCOMMITTED; comma++;}
#endif
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_FETCH_DIRS;
if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_NEXT)
{s += langDBINF_NEXT; comma++;}
{if (comma++) s += ", "; s += langDBINF_BOOKMARK;}
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_LOCK_TYPES;
if (pDb->dbInf.lockTypes & SQL_LCK_NO_CHANGE)
{s += langDBINF_NO_CHANGE; comma++;}
{if (comma++) s += ", "; s += langDBINF_UNLOCK;}
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_POS_OPERS;
if (pDb->dbInf.posOperations & SQL_POS_POSITION)
{s += langDBINF_POSITION; comma++;}
{if (comma++) s += ", "; s += langDBINF_ADD;}
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_POS_STMTS;
if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_DELETE)
{s += langDBINF_POS_DEL; comma++;}
{if (comma++) s += ", "; s += langDBINF_SELECT_FOR_UPD;}
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_SCROLL_CONCURR;
if (pDb->dbInf.scrollConcurrency & SQL_SCCO_READ_ONLY)
{s += langDBINF_READ_ONLY; comma++;}
{if (comma++) s += ", "; s += langDBINF_OPT_VALUES;}
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_SCROLL_OPTS;
if (pDb->dbInf.scrollOptions & SQL_SO_FORWARD_ONLY)
{s += langDBINF_FWD_ONLY; comma++;}
{if (comma++) s += ", "; s += langDBINF_MIXED;}
s += "\n";
- comma = false;
+ comma = FALSE;
s += langDBINF_STATIC_SENS;
if (pDb->dbInf.staticSensitivity & SQL_SS_ADDITIONS)
{s += langDBINF_ADDITIONS; comma++;}
if (pDb->dbInf.staticSensitivity & SQL_SS_UPDATES)
{if (comma++) s += ", "; s += langDBINF_UPDATES;}
s += "\n";
+#ifdef __VMS__
+#pragma message enable incboodep
+#endif
s += langDBINF_TXN_CAPABLE;
DbGridFrame::DbGridFrame(wxWindow *parent)
: wxFrame (parent, -1, wxT("Database Table"),
- wxDefaultPosition, wxSize(400, 325))
+ wxDefaultPosition, wxSize(400, 325))
{
- initialized = false;
+ initialized = FALSE;
}
if (!Contact)
{
wxMessageBox(wxT("Unable to instantiate an instance of Ccontact"), wxT("Error..."), wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
if (!Contact->Open())
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
}
- return false;
+ return FALSE;
}
// Execute the following query using the cursor designated
tStr = wxT("ODBC error during Query()\n\n");
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
- return false;
+ return FALSE;
}
// No data has been read in from the database yet, so
// so Fit() can correctly size the grid
Contact->Initialize();
- wxDbGridTableBase* db = new wxDbGridTableBase(Contact, cols, wxUSE_QUERY, true);
+ wxDbGridTableBase* db = new wxDbGridTableBase(Contact, cols, wxUSE_QUERY, TRUE);
delete cols;
- grid->SetTable(db,true);
+ grid->SetTable(db,TRUE);
grid->SetMargins(0, 0);
grid->Fit();
size.x += 10;
size.y += 10;
SetClientSize(size);
- initialized = true;
- return true;
+ initialized = TRUE;
+ return TRUE;
} // DbGridFrame::Initialize()
#endif // #if wxUSE_NEW_GRID
TEST CODE FOR TESTING THE wxDbCreateDataSource() FUNCTION
int result = 0;
- result = wxDbCreateDataSource(wxT("Microsoft Access Driver (*.mdb)"),wxT("GLT-TEST2"),wxT("GLT-Descrip"),false,wxT(""),this);
+ result = wxDbCreateDataSource(wxT("Microsoft Access Driver (*.mdb)"),wxT("GLT-TEST2"),wxT("GLT-Descrip"),FALSE,wxT(""),this);
if (!result)
{
// check for errors caused by ConfigDSN based functions