]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/db/dbtest.cpp
1. use three numbers version in win32 DLLs on unstable branch
[wxWidgets.git] / samples / db / dbtest.cpp
index 9a28a5ddadb13bfc541bdf16d8d8a17cd9f47f11..38345aacb443d0c191340f144ffcdab3b47e6342 100644 (file)
 #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 */
+//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"
+
+#define CHOICEINT
+#endif
 
 #include "dbtest.h"                 /* Header file for this demonstration program */
 #include "listdb.h"                 /* Code to support the "Lookup" button on the editor dialog */
@@ -54,49 +62,554 @@ IMPLEMENT_APP(DatabaseDemoApp)
 extern wxChar ListDB_Selection[];   /* Used to return the first column value for the selected line from the listDB routines */
 extern wxChar ListDB_Selection2[];  /* Used to return the second column value for the selected line from the listDB routines */
 
-const char *GetExtendedDBErrorMsg(wxDb *pDb, char *ErrFile, int ErrLine)
+
+#if !wxUSE_ODBC
+  #error Sample cannot be compiled unless setup.h has wxUSE_ODBC set to 1
+#endif
+
+
+bool DataTypeSupported(wxDb *pDb, SWORD datatype, wxString *nativeDataTypeName)
 {
-    static wxString msg;
-    msg = wxT("");
+    wxDbSqlTypeInfo sqlTypeInfo;
 
-    wxString tStr;
+    bool breakpoint = FALSE;
 
-    if (ErrFile || ErrLine)
+    *nativeDataTypeName = wxEmptyString;
+    if (pDb->GetDataTypeInfo(datatype, sqlTypeInfo))
     {
-        msg += wxT("File: ");
-        msg += ErrFile;
-        msg += wxT("   Line: ");
-        tStr.Printf(wxT("%d"),ErrLine);
-        msg += tStr.c_str();
-        msg += wxT("\n");
+        *nativeDataTypeName = sqlTypeInfo.TypeName;
+        breakpoint = TRUE;
     }
 
-    msg.Append (wxT("\nODBC errors:\n"));
-    msg += wxT("\n");
-    
-    // Display errors for this connection
-    int i;
-    for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
+    return breakpoint;
+
+}  // GetDataTypesSupported();
+
+
+
+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, &nativeDataTypeName))
     {
-        if (pDb->errorList[i])
-        {
-            msg.Append(pDb->errorList[i]);
-            if (wxStrcmp(pDb->errorList[i],wxT("")) != 0)
-                msg.Append(wxT("\n"));
-            // Clear the errmsg buffer so the next error will not
-            // end up showing the previous error that have occurred
-            wxStrcpy(pDb->errorList[i],wxT(""));
-        }
+        nativeDataTypeName = "SQL_C_BINARY (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_BOOKMARK (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_DATE (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_DOUBLE (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_GUID (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &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, &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, &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, &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, &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, &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, &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, &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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_INTERVAL_MONTH (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_INTERVAL_YEAR_TO_MONTH (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_NUMERIC (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_SHORT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_SSHORT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_TIME (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_TINYINT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_TYPE_TIME (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_UBIGINT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_USHORT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_VARBOOKMARK (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+
+// Extended SQL types
+#ifdef SQL_DATE
+    if (DataTypeSupported(pDb,SQL_DATE, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_DATE (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_INTERVAL
+    if (DataTypeSupported(pDb,SQL_INTERVAL, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_INTERVAL (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_TIME
+    if (DataTypeSupported(pDb,SQL_TIME, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_TIME (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_TIMESTAMP
+    if (DataTypeSupported(pDb,SQL_TIMESTAMP, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_TIMESTAMP (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_LONGVARCHAR
+    if (DataTypeSupported(pDb,SQL_LONGVARCHAR, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_LONGVARCHAR (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_BINARY
+    if (DataTypeSupported(pDb,SQL_BINARY, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_BINARY (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_VARBINARY
+    if (DataTypeSupported(pDb,SQL_VARBINARY, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_VARBINARY (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_LONGVARBINARY
+    if (DataTypeSupported(pDb,SQL_LONGVARBINARY, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_LOGVARBINARY (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_BIGINT
+    if (DataTypeSupported(pDb,SQL_BIGINT, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_BIGINT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_TINYINT
+    if (DataTypeSupported(pDb,SQL_TINYINT, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_TINYINT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
     }
-    msg += wxT("\n");
+#endif
+#ifdef SQL_BIT
+    if (DataTypeSupported(pDb,SQL_BIT, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_BIT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_GUID
+    if (DataTypeSupported(pDb,SQL_GUID, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_GUID (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
 
-    return msg.c_str();
-}  // GetExtendedDBErrorMsg
+#ifdef SQL_CHAR
+    if (DataTypeSupported(pDb,SQL_CHAR, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_CHAR (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_INTEGER
+    if (DataTypeSupported(pDb,SQL_INTEGER, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_INTEGER (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_SMALLINT
+    if (DataTypeSupported(pDb,SQL_SMALLINT, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_SAMLLINT (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_REAL
+    if (DataTypeSupported(pDb,SQL_REAL, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_REAL (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_DOUBLE
+    if (DataTypeSupported(pDb,SQL_DOUBLE, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_DOUBLE (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_NUMERIC
+    if (DataTypeSupported(pDb,SQL_NUMERIC, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_NUMERIC (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_DATE
+    if (DataTypeSupported(pDb,SQL_DATE, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_DATE (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_TIME
+    if (DataTypeSupported(pDb,SQL_TIME, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_TIME (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef SQL_TIMESTAMP
+    if (DataTypeSupported(pDb,SQL_TIMESTAMP, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_TIMESTAMP (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+#ifdef 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, &nativeDataTypeName))
+    {
+        nativeDataTypeName = "SQL_C_TCHAR (" + nativeDataTypeName;
+        nativeDataTypeName += ")";
+        wxLogMessage(nativeDataTypeName);
+    }
+#endif
+
+    wxLogMessage("\n");
+}  // CheckSupportForAllDataTypes()
 
 
 bool DatabaseDemoApp::OnInit()
 {
-    DbConnectInf = NULL;
+    DbConnectInf    = NULL;
+    Contact         = NULL;
 
     // Create the main frame window
     DemoFrame = new DatabaseDemoFrame(NULL, wxT("wxWindows Database Demo"), wxPoint(50, 50), wxSize(537, 480));
@@ -109,18 +622,21 @@ bool DatabaseDemoApp::OnInit()
     file_menu->Append(FILE_CREATE, wxT("&Create CONTACT table"));
     file_menu->Append(FILE_RECREATE_TABLE, wxT("&Recreate CONTACT table"));
     file_menu->Append(FILE_RECREATE_INDEXES, wxT("&Recreate CONTACT indexes"));
+#if wxUSE_NEW_GRID
+    file_menu->Append(FILE_DBGRID_TABLE,  wxT("&Open DB Grid example"));
+#endif
     file_menu->Append(FILE_EXIT, wxT("E&xit"));
 
     wxMenu *edit_menu = new wxMenu;
     edit_menu->Append(EDIT_PARAMETERS, wxT("&Parameters..."));
 
-    wxMenu *about_menu = new wxMenu;
-    about_menu->Append(ABOUT_DEMO, wxT("&About"));
+    wxMenu *help_menu = new wxMenu;
+    help_menu->Append(HELP_ABOUT, wxT("&About"));
 
     wxMenuBar *menu_bar = new wxMenuBar;
     menu_bar->Append(file_menu, wxT("&File"));
     menu_bar->Append(edit_menu, wxT("&Edit"));
-    menu_bar->Append(about_menu, wxT("&About"));
+    menu_bar->Append(help_menu, wxT("&Help"));
     DemoFrame->SetMenuBar(menu_bar);
 
     params.ODBCSource[0] = 0;
@@ -131,8 +647,6 @@ bool DatabaseDemoApp::OnInit()
     // Show the frame
     DemoFrame->Show(TRUE);
 
-    ReadParamFile(params);
-
     // Passing NULL for the SQL environment handle causes
     // the wxDbConnectInf constructor to obtain a handle
     // for you.
@@ -146,18 +660,29 @@ bool DatabaseDemoApp::OnInit()
     if (!DbConnectInf || !DbConnectInf->GetHenv())
     {
         wxMessageBox(wxT("Unable to define data source connection info."), wxT("DB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
-        delete DbConnectInf;
+        wxDELETE(DbConnectInf);
+    }
+
+    if (!ReadParamFile(params))
+        DemoFrame->BuildParameterDialog(NULL);
+
+    if (!wxStrlen(params.ODBCSource))
+    {
+        wxDELETE(DbConnectInf);
+        return(FALSE);
     }
 
+    DbConnectInf->SetDsn(params.ODBCSource);
+    DbConnectInf->SetUserID(params.UserName);
+    DbConnectInf->SetPassword(params.Password);
+    DbConnectInf->SetDefaultDir(params.DirPath);
 
     READONLY_DB = wxDbGetConnection(DbConnectInf);
     if (READONLY_DB == 0)
     {
         wxMessageBox(wxT("Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the CONTACT table prior to making a connection\n(using tools provided by the database manufacturer)"), wxT("DB CONNECTION ERROR..."),wxOK | wxICON_EXCLAMATION);
         DemoFrame->BuildParameterDialog(NULL);
-        DbConnectInf->SetDsn("");
-        DbConnectInf->SetUid("");
-        DbConnectInf->SetPassword("");
+        wxDELETE(DbConnectInf);
         wxMessageBox(wxT("Now exiting program.\n\nRestart program to try any new settings."),wxT("Notice..."),wxOK | wxICON_INFORMATION);
         return(FALSE);
     }
@@ -171,6 +696,20 @@ bool DatabaseDemoApp::OnInit()
 }  // 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 &params)
 {
     FILE *paramFile;
@@ -180,26 +719,24 @@ bool DatabaseDemoApp::ReadParamFile(Cparameters &params)
         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);
 
-        DemoFrame->BuildParameterDialog(NULL);
-        if ((paramFile = fopen(PARAM_FILENAME, wxT("r"))) == NULL)
-            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);
@@ -246,44 +783,34 @@ void DatabaseDemoApp::CreateDataTable(bool recreate)
 
     bool success = TRUE;
 
-    // Use a temporary instance of a new Ccontact table object
-    // for creating the table within the datasource.
-    Ccontact *Contact = new Ccontact();
-
-    if (!Contact)
-    {
-        wxEndBusyCursor();
-        wxMessageBox(wxT("Error allocating memory for 'Ccontact'object.\n\nTable was not created."),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
-        return;
-    }
+    Contact->GetDb()->RollbackTrans();  // Make sure the current cursor is in a known/stable state
 
     if (!Contact->CreateTable(recreate))
     {
         wxEndBusyCursor();
         wxString tStr;
-        tStr  = wxT("Error creating CONTACTS table.\nTable was not created.\n\n");
-        tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-        wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+        tStr = wxT("Error creating CONTACTS table.\nTable was not created.\n\n");
+        wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),Contact->GetDb(),__FILE__,__LINE__),
+                     wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+
         success = FALSE;
     }
     else
     {
-        if (!Contact->CreateIndexes())
+        if (!Contact->CreateIndexes(recreate))
         {
             wxEndBusyCursor();
             wxString tStr;
-            tStr  = wxT("Error creating CONTACTS indexes.\nIndexes will be unavailable.\n\n");
-            tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            tStr = wxT("Error creating CONTACTS indexes.\nIndexes will be unavailable.\n\n");
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+
             success = FALSE;
         }
     }
     while (wxIsBusy())
         wxEndBusyCursor();
 
-    delete Contact;
-    Contact = NULL;
-
     if (success)
         wxMessageBox(wxT("Table and index(es) were successfully created."),wxT("Notice..."),wxOK | wxICON_INFORMATION);
 }  // DatabaseDemoApp::CreateDataTable()
@@ -293,9 +820,12 @@ BEGIN_EVENT_TABLE(DatabaseDemoFrame, wxFrame)
     EVT_MENU(FILE_CREATE, DatabaseDemoFrame::OnCreate)
     EVT_MENU(FILE_RECREATE_TABLE, DatabaseDemoFrame::OnRecreateTable)
     EVT_MENU(FILE_RECREATE_INDEXES, DatabaseDemoFrame::OnRecreateIndexes)
+#if wxUSE_NEW_GRID
+    EVT_MENU(FILE_DBGRID_TABLE, DatabaseDemoFrame::OnDbGridTable)
+#endif
     EVT_MENU(FILE_EXIT, DatabaseDemoFrame::OnExit)
     EVT_MENU(EDIT_PARAMETERS, DatabaseDemoFrame::OnEditParameters)
-    EVT_MENU(ABOUT_DEMO, DatabaseDemoFrame::OnAbout)
+    EVT_MENU(HELP_ABOUT, DatabaseDemoFrame::OnAbout)
     EVT_CLOSE(DatabaseDemoFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
@@ -308,8 +838,16 @@ DatabaseDemoFrame::DatabaseDemoFrame(wxFrame *frame, const wxString& title,
     // Put any code in necessary for initializing the main frame here
     pEditorDlg = NULL;
     pParamDlg  = NULL;
+
+    delete wxLog::SetActiveTarget(new wxLogStderr);
+
 }  // DatabaseDemoFrame constructor
 
+DatabaseDemoFrame::~DatabaseDemoFrame()
+{
+    delete wxLog::SetActiveTarget(NULL);
+}  // DatabaseDemoFrame destructor
+
 
 void DatabaseDemoFrame::OnCreate(wxCommandEvent& event)
 {
@@ -325,30 +863,35 @@ void DatabaseDemoFrame::OnRecreateTable(wxCommandEvent& event)
 
 void DatabaseDemoFrame::OnRecreateIndexes(wxCommandEvent& event)
 {
-    // Using a new connection to the database so as not to disturb
-    // the current cursors on the table in use in the editor dialog
-    Ccontact *Contact = new Ccontact();
+    wxGetApp().Contact->GetDb()->RollbackTrans();  // Make sure the current cursor is in a known/stable state
 
-    if (!Contact)
+    if (!wxGetApp().Contact->CreateIndexes(TRUE))
     {
-        wxEndBusyCursor();
-        wxMessageBox(wxT("Error allocating memory for 'Ccontact'object.\n\nTable could not be opened."),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
-        return;
-    }
+        while (wxIsBusy())
+            wxEndBusyCursor();
+        wxString tStr;
+        tStr = wxT("Error creating CONTACTS indexes.\nNew indexes will be unavailable.\n\n");
+        wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                     wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
 
-    if (!Contact->CreateIndexes())
-    {
-       wxEndBusyCursor();
-       wxString tStr;
-       tStr  = wxT("Error creating CONTACTS indexes.\nNew indexes will be unavailable.\n\n");
-       tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-       wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
     }
+     else
+        wxMessageBox(wxT("Index(es) were successfully recreated."),wxT("Notice..."),wxOK | wxICON_INFORMATION);
 
-    delete Contact;
-    Contact = NULL;
 }  // DatabaseDemoFrame::OnRecreateIndexes()
 
+
+#if wxUSE_NEW_GRID
+void DatabaseDemoFrame::OnDbGridTable(wxCommandEvent& )
+{
+    DbGridFrame *frame = new DbGridFrame(this);
+    if (frame->Initialize())
+    {
+        frame->Show();
+    }
+}
+#endif
+
 void DatabaseDemoFrame::OnExit(wxCommandEvent& event)
 {
     Close();
@@ -386,6 +929,8 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event)
         }
     }
 
+    wxDELETE(wxGetApp().Contact);
+
     // This function will close all the connections to the database that have been
     // previously cached.
     wxDbCloseConnections();
@@ -393,8 +938,7 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event)
     // Deletion of the wxDbConnectInf instance must be the LAST thing done that
     // has anything to do with the database.  Deleting this before disconnecting,
     // freeing/closing connections, etc will result in a crash!
-    delete wxGetApp().DbConnectInf;
-    wxGetApp().DbConnectInf = NULL;
+    wxDELETE(wxGetApp().DbConnectInf);
 
     this->Destroy();
 
@@ -455,6 +999,9 @@ Ccontact::Ccontact (wxDb *pwxDb) : wxDbTable(pwxDb ? pwxDb : wxDbGetConnection(w
     // released when the last database instance using the connection is deleted
     freeDbConn = !pwxDb;
     
+    if (GetDb())
+        GetDb()->SetSqlLogging(sqlLogON);
+
     SetupColumns();
 
 }  // Ccontact Constructor
@@ -490,9 +1037,10 @@ Ccontact::~Ccontact()
         if (!wxDbFreeConnection(GetDb()))
         {
             wxString tStr;
-            tStr  = wxT("Unable to Free the Ccontact data table handle\n\n");
-            tStr += GetExtendedDBErrorMsg(GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            tStr = wxT("Unable to Free the Ccontact data table handle\n\n");
+
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
         }
     }
 }  // Ccontract destructor
@@ -516,13 +1064,16 @@ void Ccontact::SetupColumns()
     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_USHORT,               sizeof(Contributions),  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_C_BINARY,          sizeof(Picture),        FALSE,TRUE);
+#endif
 }  // Ccontact::SetupColumns
 
 
-bool Ccontact::CreateIndexes(void)
+bool Ccontact::CreateIndexes(bool recreate)
 {
     // This index could easily be accomplished with an "orderBy" clause, 
     // but is done to show how to construct a non-primary index.
@@ -539,7 +1090,7 @@ bool Ccontact::CreateIndexes(void)
 
     indexName = GetTableName();
     indexName += "_IDX1";
-    Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef);
+    Ok = CreateIndex(indexName.c_str(), TRUE, 2, idxDef, recreate);
 
     return Ok;
 }  // Ccontact::CreateIndexes()
@@ -552,7 +1103,7 @@ bool Ccontact::CreateIndexes(void)
  */
 bool Ccontact::FetchByName(const wxString &name)
 {
-    whereStr.Printf(wxT("NAME = '%s'"),name);
+    whereStr.Printf(wxT("NAME = '%s'"),name.c_str());
     SetWhereClause(whereStr.c_str());
     SetOrderByClause(wxT(""));
 
@@ -595,7 +1146,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 0, 0, 537, 480)
 
     initialized = FALSE;
 
-    Contact = NULL;
+    SetMode(mView);
 
     Show(FALSE);
 }  // CeditorDlg constructor
@@ -606,11 +1157,6 @@ void CeditorDlg::OnCloseWindow(wxCloseEvent& event)
     // Clean up time
     if ((mode != mCreate) && (mode != mEdit))
     {
-        if (Contact)
-        {
-            delete Contact;
-            Contact = NULL;
-        }
         this->Destroy();
     }
     else
@@ -639,7 +1185,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
 
     if (widgetName == pCreateBtn->GetName())
     {
-        Contact->Initialize();
+        wxGetApp().Contact->Initialize();
         PutData();
         SetMode( mCreate );
         pNameTxt->SetValue(wxT(""));
@@ -649,7 +1195,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
 
     if (widgetName == pEditBtn->GetName())
     {
-        saveName = Contact->Name;
+        saveName = wxGetApp().Contact->Name;
         SetMode( mEdit );
         pNameTxt->SetFocus();
         return;
@@ -660,7 +1206,6 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         SetMode(mCreate);
         pNameTxt->SetValue(wxT(""));
         pNameTxt->SetFocus();
-
         return;
     }
 
@@ -671,7 +1216,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         if (!Ok)
             return;
 
-        if (Ok && Contact->Delete())
+        if (Ok && wxGetApp().Contact->Delete())
         {
             // NOTE: Deletions are not finalized until a CommitTrans() is performed.  
             //       If the commit were not performed, the program will continue to 
@@ -679,7 +1224,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
             //       of Ccontact is deleted.  If the Commit wasn't performed, the 
             //       database will automatically Rollback the changes when the database
             //       connection is terminated
-            Contact->GetDb()->CommitTrans();
+            wxGetApp().Contact->GetDb()->CommitTrans();
 
             // Try to get the row that followed the just deleted row in the orderBy sequence
             if (!GetNextRec())
@@ -689,7 +1234,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
                 if (!GetPrevRec())
                 {
                     // There are now no rows remaining, so clear the dialog widgets
-                    Contact->Initialize();
+                    wxGetApp().Contact->Initialize();
                     PutData();
                 }
             }
@@ -697,7 +1242,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         }
         else
             // Delete failed
-            Contact->GetDb()->RollbackTrans();
+            wxGetApp().Contact->GetDb()->RollbackTrans();
 
         SetMode(mView);
         return;
@@ -718,7 +1263,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
 
         if (saveName.IsEmpty())
         {
-            Contact->Initialize();
+            wxGetApp().Contact->Initialize();
             PutData();
             SetMode(mView);
             return;
@@ -726,7 +1271,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         else
         {
             // Requery previous record
-            if (Contact->FetchByName(saveName))
+            if (wxGetApp().Contact->FetchByName(saveName))
             {
                 PutData();
                 SetMode(mView);
@@ -735,33 +1280,35 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         }
 
         // Previous record not available, retrieve first record in table
-        if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
+        if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
+            wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
         {
-            Contact->whereStr  = wxT("NAME = (SELECT MIN(NAME) FROM ");
-            Contact->whereStr += Contact->GetTableName();
-            Contact->whereStr += wxT(")");
-            Contact->SetWhereClause(Contact->whereStr.c_str());
+            wxGetApp().Contact->whereStr  = wxT("NAME = (SELECT MIN(NAME) FROM ");
+            wxGetApp().Contact->whereStr += wxGetApp().Contact->GetTableName();
+            wxGetApp().Contact->whereStr += wxT(")");
+            wxGetApp().Contact->SetWhereClause(wxGetApp().Contact->whereStr.c_str());
         }
         else
-            Contact->SetWhereClause(wxT(""));
+            wxGetApp().Contact->SetWhereClause(wxT(""));
 
-        if (!Contact->Query())
+        if (!wxGetApp().Contact->Query())
         {
             wxString tStr;
-            tStr  = wxT("ODBC error during Query()\n\n");
-            tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            tStr = wxT("ODBC error during Query()\n\n");
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            
             SetMode(mView);
             return;
         }
-        if (Contact->GetNext())  // Successfully read first record
+        if (wxGetApp().Contact->GetNext())  // Successfully read first record
         {
             PutData();
             SetMode(mView);
             return;
         }
         // No contacts are available, clear dialog
-        Contact->Initialize();
+        wxGetApp().Contact->Initialize();
         PutData();
         SetMode(mView);
         return;
@@ -785,50 +1332,52 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
     {
         // Display the query dialog box
         wxChar qryWhere[DB_MAX_WHERE_CLAUSE_LEN+1];
-        wxStrcpy(qryWhere, (const wxChar*) Contact->qryWhereStr);
+        wxStrcpy(qryWhere, (const wxChar*) wxGetApp().Contact->qryWhereStr);
         wxChar *tblName[] = {(wxChar *)CONTACT_TABLE_NAME, 0};
-        new CqueryDlg(GetParent(), Contact->GetDb(), tblName, qryWhere);
+        new CqueryDlg(GetParent(), wxGetApp().Contact->GetDb(), tblName, qryWhere);
 
         // Query the first record in the new record set and
         // display it, if the query string has changed.
-        if (wxStrcmp(qryWhere, (const wxChar*) Contact->qryWhereStr))
+        if (wxStrcmp(qryWhere, (const wxChar*) wxGetApp().Contact->qryWhereStr))
         {
-            Contact->whereStr.Empty();
-            Contact->SetOrderByClause("NAME");
+            wxGetApp().Contact->whereStr.Empty();
+            wxGetApp().Contact->SetOrderByClause("NAME");
 
-            if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
+            if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
+                wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
             {
-                Contact->whereStr  = wxT("NAME = (SELECT MIN(NAME) FROM ");
-                Contact->whereStr += CONTACT_TABLE_NAME;
+                wxGetApp().Contact->whereStr  = wxT("NAME = (SELECT MIN(NAME) FROM ");
+                wxGetApp().Contact->whereStr += CONTACT_TABLE_NAME;
             }
             
             // Append the query where string (if there is one)
-            Contact->qryWhereStr  = qryWhere;
+            wxGetApp().Contact->qryWhereStr  = qryWhere;
             if (wxStrlen(qryWhere))
             {
-                Contact->whereStr += wxT(" WHERE ");
-                Contact->whereStr += Contact->qryWhereStr;
+                wxGetApp().Contact->whereStr += wxT(" WHERE ");
+                wxGetApp().Contact->whereStr += wxGetApp().Contact->qryWhereStr;
             }
             // Close the expression with a right paren
-            Contact->whereStr += wxT(")");
+            wxGetApp().Contact->whereStr += wxT(")");
             // Requery the table
-            Contact->SetWhereClause(Contact->whereStr.c_str());
-            if (!Contact->Query())
+            wxGetApp().Contact->SetWhereClause(wxGetApp().Contact->whereStr.c_str());
+            if (!wxGetApp().Contact->Query())
             {
                 wxString tStr;
-                tStr  = wxT("ODBC error during Query()\n\n");
-                tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-                wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+                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;
             }
             // Display the first record from the query set
-            if (!Contact->GetNext())
-                Contact->Initialize();
+            if (!wxGetApp().Contact->GetNext())
+                wxGetApp().Contact->Initialize();
             PutData();
         }
 
         // Enable/Disable the reset button
-        pResetBtn->Enable(!Contact->qryWhereStr.IsEmpty());
+        pResetBtn->Enable(!wxGetApp().Contact->qryWhereStr.IsEmpty());
 
         return;
     }  // Query button
@@ -837,27 +1386,28 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
     if (widgetName == pResetBtn->GetName())
     {
         // Clear the additional where criteria established by the query feature
-        Contact->qryWhereStr = wxT("");
-        Contact->SetOrderByClause(wxT("NAME"));
+        wxGetApp().Contact->qryWhereStr = wxT("");
+        wxGetApp().Contact->SetOrderByClause(wxT("NAME"));
 
-        if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
+        if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
+            wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
         {
-            Contact->whereStr  = wxT("NAME = (SELECT MIN(NAME) FROM ");
-            Contact->whereStr += CONTACT_TABLE_NAME;
-            Contact->whereStr += wxT(")");
+            wxGetApp().Contact->whereStr  = wxT("NAME = (SELECT MIN(NAME) FROM ");
+            wxGetApp().Contact->whereStr += CONTACT_TABLE_NAME;
+            wxGetApp().Contact->whereStr += wxT(")");
         }
 
-        Contact->SetWhereClause(Contact->whereStr.c_str());
-        if (!Contact->Query())
+        wxGetApp().Contact->SetWhereClause(wxGetApp().Contact->whereStr.c_str());
+        if (!wxGetApp().Contact->Query())
         {
             wxString tStr;
-            tStr  = wxT("ODBC error during Query()\n\n");
-            tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            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;
         }
-        if (!Contact->GetNext())
-            Contact->Initialize();
+        if (!wxGetApp().Contact->GetNext())
+            wxGetApp().Contact->Initialize();
         PutData();
         pResetBtn->Enable(FALSE);
 
@@ -888,6 +1438,30 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
 
         return;
     }
+
+    if (widgetName == pDataTypesBtn->GetName())
+    {
+        CheckSupportForAllDataTypes(wxGetApp().READONLY_DB);
+        wxMessageBox("Support datatypes was dumped to stdout.");
+        return;
+    }  // Data types Button
+
+    if (widgetName == pDbDiagsBtn->GetName())
+    {
+        DisplayDbDiagnostics(wxGetApp().READONLY_DB);
+        wxMessageBox("Diagnostics info was dumped to stdout.");
+        return;
+    }
+
+    if (widgetName == pCatalogBtn->GetName())
+    {
+        if (wxGetApp().Contact->GetDb()->Catalog("","catalog.txt"))
+            wxMessageBox("The file 'catalog.txt' was created.");
+        else
+            wxMessageBox("Creation of the file 'catalog.txt' was failed.");
+        return;
+    }
+
 }  // CeditorDlg::OnCommand()
 
 
@@ -896,9 +1470,9 @@ bool CeditorDlg::Initialize()
     // Create the data structure and a new database connection.  
     // (As there is not a pDb being passed in the constructor, a new database
     // connection is created)
-    Contact = new Ccontact();
+    wxGetApp().Contact = new Ccontact();
 
-    if (!Contact)
+    if (!wxGetApp().Contact)
     {
         wxMessageBox(wxT("Unable to instantiate an instance of Ccontact"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
         return FALSE;
@@ -906,16 +1480,13 @@ bool CeditorDlg::Initialize()
 
     // Check if the table exists or not.  If it doesn't, ask the user if they want to 
     // create the table.  Continue trying to create the table until it exists, or user aborts
-    while (!Contact->GetDb()->TableExists((wxChar *)CONTACT_TABLE_NAME, 
+    while (!wxGetApp().Contact->GetDb()->TableExists((wxChar *)CONTACT_TABLE_NAME, 
                                           wxGetApp().DbConnectInf->GetUserID(), 
                                           wxGetApp().DbConnectInf->GetDefaultDir()))
     {
         wxString tStr;
-        tStr.Printf(wxT("Unable to open the table '%s'.\n\nTable may need to be created...?\n\n"),CONTACT_TABLE_NAME);
-        tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-        wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
-
-        bool createTable = (wxMessageBox(wxT("Do you wish to try to create/clear the CONTACTS table?"),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES);
+        tStr.Printf(wxT("Unable to open the table '%s'.  The table may\nneed to be created.\n\nDo you wish to try to create/clear the table?\n\n"),CONTACT_TABLE_NAME);
+        bool createTable = (wxMessageBox(tStr.c_str(),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES);
 
         if (!createTable)
         {
@@ -923,36 +1494,41 @@ bool CeditorDlg::Initialize()
             return FALSE;
         }
         else
-            wxGetApp().CreateDataTable(TRUE);
+            wxGetApp().CreateDataTable(FALSE);
     }
 
     // Tables must be "opened" before anything other than creating/deleting table can be done
-    if (!Contact->Open())
+    if (!wxGetApp().Contact->Open())
     {
         // Table does exist, or there was some problem opening it.  Currently this should
         // never fail, except in the case of the table not exisiting or the current
         // user has insufficent privileges to access the table
-#if 0
+#if 1
 // This code is experimenting with a new function that will hopefully be available
 // in the 2.4 release.  This check will determine whether the open failing was due
 // to the table not existing, or the users privileges being insufficient to
 // open the table.
-        if (!Contact->GetDb()->TablePrivileges(CONTACT_TABLE_NAME,wxT("SELECT"),Contact->GetDb()->GetUsername(),Contact->GetDb()->GetUsername(),DbConnectInf->GetDefaultDir()))
+        if (!wxGetApp().Contact->GetDb()->TablePrivileges(CONTACT_TABLE_NAME, wxT("SELECT"),
+                                                wxGetApp().Contact->GetDb()->GetUsername(),
+                                                wxGetApp().Contact->GetDb()->GetUsername(),
+                                                wxGetApp().DbConnectInf->GetDefaultDir()))
         {
             wxString tStr;
-            tStr.Printf(wxT("Unable to open the table '%s'.\n\n"),CONTACT_TABLE_NAME);
-            tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            tStr.Printf(wxT("Unable to open the table '%s' (likely due to\ninsufficient privileges of the logged in user).\n\n"),CONTACT_TABLE_NAME);
+
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
         }
         else 
 #endif
-        if (Contact->GetDb()->TableExists(CONTACT_TABLE_NAME, Contact->GetDb()->GetUsername(),
-                                          wxGetApp().DbConnectInf->GetDefaultDir()))
+        if (!wxGetApp().Contact->GetDb()->TableExists(CONTACT_TABLE_NAME,
+                                           wxGetApp().Contact->GetDb()->GetUsername(),
+                                           wxGetApp().DbConnectInf->GetDefaultDir()))
         {
             wxString tStr;
-            tStr.Printf(wxT("Unable to open the table '%s'.\n\n"),CONTACT_TABLE_NAME);
-            tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            tStr.Printf(wxT("Unable to open the table '%s' as the table\ndoes not appear to exist in the tablespace available\nto the currently logged in user.\n\n"),CONTACT_TABLE_NAME);
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
         }
 
         return FALSE;
@@ -1010,6 +1586,10 @@ bool CeditorDlg::Initialize()
     pLinesMsg         = new wxStaticText(this, EDITOR_DIALOG_LINES_MSG,  wxT("Lines of code:"),   wxPoint(303, 380), wxSize( -1,  -1), 0, wxT("LinesMsg"));
     pLinesTxt         = new wxTextCtrl(this, EDITOR_DIALOG_LINES_TEXT,   wxT(""),                 wxPoint(303, 397), wxSize(100,  25), 0, wxDefaultValidator, wxT("LinesTxt"));
 
+    pCatalogBtn       = new wxButton(this, EDITOR_DIALOG_CATALOG,        wxT("Catalo&g"),         wxPoint(430, 287), wxSize( 70,  35), 0, wxDefaultValidator, wxT("CatalogBtn"));
+    pDataTypesBtn     = new wxButton(this, EDITOR_DIALOG_DATATYPES,      wxT("Data&types"),       wxPoint(430, 337), wxSize( 70,  35), 0, wxDefaultValidator, wxT("DataTypesBtn"));
+    pDbDiagsBtn       = new wxButton(this, EDITOR_DIALOG_DB_DIAGS,       wxT("DB Dia&gs"),        wxPoint(430, 387), wxSize( 70,  35), 0, wxDefaultValidator, wxT("DbDiagsBtn"));
+
     // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to 
     // handle all widget processing
     widgetPtrsSet = TRUE;
@@ -1018,7 +1598,7 @@ bool CeditorDlg::Initialize()
     // as there will only be one record being shown on the dialog at a time, this optimizes
     // network traffic by only returning a one row result
     
-    Contact->SetOrderByClause(wxT("NAME"));  // field name to sort by
+    wxGetApp().Contact->SetOrderByClause(wxT("NAME"));  // field name to sort by
 
     // The wxString "whereStr" is not a member of the wxDbTable object, it is a member variable
     // specifically in the Ccontact class.  It is used here for simpler construction of a varying
@@ -1028,35 +1608,38 @@ bool CeditorDlg::Initialize()
     // The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s" 
     // to achieve a single row (in this case the first name in alphabetical order).
     
-    if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
+    if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
+        wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
     {
-        Contact->whereStr.Printf(wxT("NAME = (SELECT MIN(NAME) FROM %s)"),Contact->GetTableName());
+        wxGetApp().Contact->whereStr.Printf(wxT("NAME = (SELECT MIN(NAME) FROM %s)"),
+                                            wxGetApp().Contact->GetTableName().c_str());
         // NOTE: (const wxChar*) returns a pointer which may not be valid later, so this is short term use only
-        Contact->SetWhereClause(Contact->whereStr);
+        wxGetApp().Contact->SetWhereClause(wxGetApp().Contact->whereStr);
     }
     else
-       Contact->SetWhereClause(wxT(""));
+       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
-    if (!Contact->Query())
+    if (!wxGetApp().Contact->Query())
     {
         wxString tStr;
-        tStr  = wxT("ODBC error during Query()\n\n");
-        tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-        wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
-//        GetParent()->Close();
+        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;
     }
 
     // Since Query succeeded, now get the row that was returned
-    if (!Contact->GetNext())
+    if (!wxGetApp().Contact->GetNext())
         // If the GetNext() failed at this point, then there are no rows to retrieve, 
         // so clear the values in the members of "Contact" so that PutData() blanks the 
         // widgets on the dialog
-        Contact->Initialize();
-
+        wxGetApp().Contact->Initialize();
+/*
+    wxGetApp().Contact->GetDb()->RollbackTrans();
+*/
     SetMode(mView);
     PutData();
 
@@ -1069,6 +1652,9 @@ bool CeditorDlg::Initialize()
 
 void CeditorDlg::FieldsEditable()
 {
+    if (!widgetPtrsSet)
+        return;
+
     pNameTxt->Enable((mode == mCreate) || (mode == mEdit));
     pAddress1Txt->Enable((mode == mCreate) || (mode == mEdit));
     pAddress2Txt->Enable((mode == mCreate) || (mode == mEdit));
@@ -1108,15 +1694,15 @@ void CeditorDlg::SetMode(enum DialogModes m)
     if (widgetPtrsSet)
     {
         pCreateBtn->Enable( !edit );
-        pEditBtn->Enable( !edit && (wxStrcmp(Contact->Name,wxT(""))!=0) );
-        pDeleteBtn->Enable( !edit && (wxStrcmp(Contact->Name,wxT(""))!=0) );
-        pCopyBtn->Enable( !edit && (wxStrcmp(Contact->Name,wxT(""))!=0) );
+        pEditBtn->Enable( !edit && (wxStrcmp(wxGetApp().Contact->Name,wxT(""))!=0) );
+        pDeleteBtn->Enable( !edit && (wxStrcmp(wxGetApp().Contact->Name,wxT(""))!=0) );
+        pCopyBtn->Enable( !edit && (wxStrcmp(wxGetApp().Contact->Name,wxT(""))!=0) );
         pSaveBtn->Enable( edit );
         pCancelBtn->Enable( edit );
         pPrevBtn->Enable( !edit );
         pNextBtn->Enable( !edit );
         pQueryBtn->Enable( !edit );
-        pResetBtn->Enable( !edit && !Contact->qryWhereStr.IsEmpty() );
+        pResetBtn->Enable( !edit && !wxGetApp().Contact->qryWhereStr.IsEmpty() );
         pNameListBtn->Enable( !edit );
     }
 
@@ -1128,26 +1714,26 @@ bool CeditorDlg::PutData()
 {
     wxString tStr;
 
-    pNameTxt->SetValue(Contact->Name);
-    pAddress1Txt->SetValue(Contact->Addr1);
-    pAddress2Txt->SetValue(Contact->Addr2);
-    pCityTxt->SetValue(Contact->City);
-    pStateTxt->SetValue(Contact->State);
-    pCountryTxt->SetValue(Contact->Country);
-    pPostalCodeTxt->SetValue(Contact->PostalCode);
+    pNameTxt->SetValue(wxGetApp().Contact->Name);
+    pAddress1Txt->SetValue(wxGetApp().Contact->Addr1);
+    pAddress2Txt->SetValue(wxGetApp().Contact->Addr2);
+    pCityTxt->SetValue(wxGetApp().Contact->City);
+    pStateTxt->SetValue(wxGetApp().Contact->State);
+    pCountryTxt->SetValue(wxGetApp().Contact->Country);
+    pPostalCodeTxt->SetValue(wxGetApp().Contact->PostalCode);
 
-    tStr.Printf(wxT("%d/%d/%d"),Contact->JoinDate.month,Contact->JoinDate.day,Contact->JoinDate.year);
+    tStr.Printf(wxT("%d/%d/%d"),wxGetApp().Contact->JoinDate.month,wxGetApp().Contact->JoinDate.day,wxGetApp().Contact->JoinDate.year);
     pJoinDateTxt->SetValue(tStr);
 
-    tStr.Printf(wxT("%d"),Contact->Contributions);
+    tStr.Printf(wxT("%d"),wxGetApp().Contact->Contributions);
     pContribTxt->SetValue(tStr);
 
-    tStr.Printf(wxT("%lu"),Contact->LinesOfCode);
+    tStr.Printf(wxT("%lu"),wxGetApp().Contact->LinesOfCode);
     pLinesTxt->SetValue(tStr);
 
-    pNativeLangChoice->SetSelection(Contact->NativeLanguage);
+    pNativeLangChoice->SetSelection(wxGetApp().Contact->NativeLanguage);
 
-    pDeveloperRadio->SetSelection(Contact->IsDeveloper);
+    pDeveloperRadio->SetSelection(wxGetApp().Contact->IsDeveloper);
 
     return TRUE;
 }  // Ceditor::PutData()
@@ -1174,7 +1760,7 @@ bool CeditorDlg::GetData()
     }
 
     bool   invalid = FALSE;
-    int    mm,dd,yyyy;
+    int    mm = 1,dd = 1,yyyy = 2001;
     int    first, second;
 
     tStr = pJoinDateTxt->GetValue();
@@ -1228,9 +1814,9 @@ bool CeditorDlg::GetData()
 
     if (!invalid)
     {
-        Contact->JoinDate.month = mm;
-        Contact->JoinDate.day   = dd;
-        Contact->JoinDate.year  = yyyy;
+        wxGetApp().Contact->JoinDate.month = mm;
+        wxGetApp().Contact->JoinDate.day   = dd;
+        wxGetApp().Contact->JoinDate.year  = yyyy;
     }
     else
     {
@@ -1239,19 +1825,19 @@ bool CeditorDlg::GetData()
     }
 
     tStr = pNameTxt->GetValue();
-    wxStrcpy(Contact->Name,(const wxChar*) tStr);
-    wxStrcpy(Contact->Addr1,pAddress1Txt->GetValue());
-    wxStrcpy(Contact->Addr2,pAddress2Txt->GetValue());
-    wxStrcpy(Contact->City,pCityTxt->GetValue());
-    wxStrcpy(Contact->State,pStateTxt->GetValue());
-    wxStrcpy(Contact->Country,pCountryTxt->GetValue());
-    wxStrcpy(Contact->PostalCode,pPostalCodeTxt->GetValue());
+    wxStrcpy(wxGetApp().Contact->Name,(const wxChar*) tStr);
+    wxStrcpy(wxGetApp().Contact->Addr1,pAddress1Txt->GetValue());
+    wxStrcpy(wxGetApp().Contact->Addr2,pAddress2Txt->GetValue());
+    wxStrcpy(wxGetApp().Contact->City,pCityTxt->GetValue());
+    wxStrcpy(wxGetApp().Contact->State,pStateTxt->GetValue());
+    wxStrcpy(wxGetApp().Contact->Country,pCountryTxt->GetValue());
+    wxStrcpy(wxGetApp().Contact->PostalCode,pPostalCodeTxt->GetValue());
 
-    Contact->Contributions = atoi(pContribTxt->GetValue());
-    Contact->LinesOfCode = atol(pLinesTxt->GetValue());
+    wxGetApp().Contact->Contributions = atoi(pContribTxt->GetValue());
+    wxGetApp().Contact->LinesOfCode = atol(pLinesTxt->GetValue());
 
-    Contact->NativeLanguage = (enum Language) pNativeLangChoice->GetSelection();
-    Contact->IsDeveloper = pDeveloperRadio->GetSelection() > 0;
+    wxGetApp().Contact->NativeLanguage = (enum Language) pNativeLangChoice->GetSelection();
+    wxGetApp().Contact->IsDeveloper = pDeveloperRadio->GetSelection() > 0;
 
     return TRUE;
 }  // CeditorDlg::GetData()
@@ -1281,7 +1867,7 @@ bool CeditorDlg::Save()
 
         if (mode == mCreate)
         {
-            RETCODE result = Contact->Insert();
+            RETCODE result = wxGetApp().Contact->Insert();
 
             failed = (result != DB_SUCCESS);
             if (failed)
@@ -1291,40 +1877,41 @@ bool CeditorDlg::Save()
                 if (result == DB_ERR_INTEGRITY_CONSTRAINT_VIOL)
                 {
                     wxString tStr;
-                    tStr  = wxT("A duplicate key value already exists in the table.\nUnable to save record\n\n");
-                    tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-                    wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+                    tStr = wxT("A duplicate key value already exists in the table.\nUnable to save record\n\n");
+                    wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                                 wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
                 }
                 else
                 {
-                    // Some other unexpexted error occurred
+                    // Some other unexpected error occurred
                     wxString tStr;
-                    tStr  = wxT("Database insert failed\n\n");
-                    tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-                    wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+                    tStr = wxT("Database insert failed\n\n");
+                    wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                                 wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
                 }
             }
         }
         else  // mode == mEdit
         {
-            Contact->whereStr.Printf("NAME = '%s'",saveName.c_str());
-            if (!Contact->UpdateWhere(Contact->whereStr))
+            wxGetApp().Contact->GetDb()->RollbackTrans();
+            wxGetApp().Contact->whereStr.Printf("NAME = '%s'",saveName.c_str());
+            if (!wxGetApp().Contact->UpdateWhere(wxGetApp().Contact->whereStr))
             {
                 wxString tStr;
-                tStr  = wxT("Database update failed\n\n");
-                tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-                wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+                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;
             }
         }
 
         if (!failed)
         {
-            Contact->GetDb()->CommitTrans();
+            wxGetApp().Contact->GetDb()->CommitTrans();
             SetMode(mView);  // Sets the dialog mode back to viewing after save is successful
         }
         else
-            Contact->GetDb()->RollbackTrans();
+            wxGetApp().Contact->GetDb()->RollbackTrans();
 
         wxEndBusyCursor();
     }
@@ -1342,23 +1929,24 @@ bool CeditorDlg::GetNextRec()
 {
     wxString w;
 
-    if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
+    if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
+        wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
     {
         w  = wxT("NAME = (SELECT MIN(NAME) FROM ");
-        w += Contact->GetTableName();
+        w += wxGetApp().Contact->GetTableName();
         w += wxT(" WHERE NAME > '");
     }
     else
         w = wxT("(NAME > '");
 
-    w += Contact->Name;
+    w += wxGetApp().Contact->Name;
     w += wxT("'");
 
     // If a query where string is currently set, append that criteria
-    if (!Contact->qryWhereStr.IsEmpty())
+    if (!wxGetApp().Contact->qryWhereStr.IsEmpty())
     {
         w += wxT(" AND (");
-        w += Contact->qryWhereStr;
+        w += wxGetApp().Contact->qryWhereStr;
         w += wxT(")");
     }
 
@@ -1377,23 +1965,24 @@ bool CeditorDlg::GetPrevRec()
 {
     wxString w;
 
-    if (Contact->GetDb()->Dbms() != dbmsPOSTGRES && Contact->GetDb()->Dbms() != dbmsMY_SQL)
+    if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
+        wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
     {
         w  = wxT("NAME = (SELECT MAX(NAME) FROM ");
-        w += Contact->GetTableName();
+        w += wxGetApp().Contact->GetTableName();
         w += wxT(" WHERE NAME < '");
     }
     else
         w = wxT("(NAME < '");
 
-    w += Contact->Name;
+    w += wxGetApp().Contact->Name;
     w += wxT("'");
 
     // If a query where string is currently set, append that criteria
-    if (!Contact->qryWhereStr.IsEmpty())
+    if (!wxGetApp().Contact->qryWhereStr.IsEmpty())
     {
         w += wxT(" AND (");
-        w += Contact->qryWhereStr;
+        w += wxGetApp().Contact->qryWhereStr;
         w += wxT(")");
     }
 
@@ -1410,20 +1999,20 @@ bool CeditorDlg::GetPrevRec()
  */
 bool CeditorDlg::GetRec(const wxString &whereStr)
 {
-    Contact->SetWhereClause(whereStr);
-    Contact->SetOrderByClause(wxT("NAME"));
+    wxGetApp().Contact->SetWhereClause(whereStr);
+    wxGetApp().Contact->SetOrderByClause(wxT("NAME"));
 
-    if (!Contact->Query())
+    if (!wxGetApp().Contact->Query())
     {
         wxString tStr;
-        tStr  = wxT("ODBC error during Query()\n\n");
-        tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
-        wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+        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);
     }
 
-    if (Contact->GetNext())
+    if (wxGetApp().Contact->GetNext())
     {
         PutData();
         return(TRUE);
@@ -1551,7 +2140,11 @@ bool CparameterDlg::PutData()
 
     // 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);
@@ -1645,8 +2238,8 @@ void CparameterDlg::FillDataSourceList()
     for (i = 0; wxStrlen(p[i]); i++)
         pParamODBCSourceList->Append(p[i]);
 
-    delete [] p;
-}  // CparameterDlg::CparameterDlg::FillDataSourceList()
+    wxDELETEA(p);
+}  // CparameterDlg::FillDataSourceList()
 
 
 BEGIN_EVENT_TABLE(CqueryDlg, wxDialog)
@@ -1656,7 +2249,9 @@ END_EVENT_TABLE()
 
  
 // CqueryDlg() constructor
-CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWhereArg) : wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxPoint(-1, -1), wxSize(480, 360))
+CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], 
+                     const wxString &pWhereArg) :
+    wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxPoint(-1, -1), wxSize(480, 360))
 {
     wxBeginBusyCursor();
 
@@ -1667,8 +2262,8 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWh
     pDB = pDb;
 
     // Initialize the WHERE clause from the string passed in
-    pWhere = pWhereArg;                                            // Save a pointer to the output buffer
-    if (wxStrlen(pWhere) > (unsigned int)DB_MAX_WHERE_CLAUSE_LEN)  // Check the length of the buffer passed in
+    pWhere = pWhereArg;                                           // Save a pointer to the output buffer
+    if (pWhere.Length() > (unsigned int)DB_MAX_WHERE_CLAUSE_LEN)  // Check the length of the buffer passed in
     {
         wxString s;
         s.Printf(wxT("Maximum where clause length exceeded.\nLength must be less than %d"), DB_MAX_WHERE_CLAUSE_LEN+1);
@@ -1724,9 +2319,9 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWh
     {
         wxEndBusyCursor();
         wxString tStr;
-        tStr  = wxT("ODBC error during GetColumns()\n\n");
-        tStr += GetExtendedDBErrorMsg(pDb,__FILE__,__LINE__);
-        wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+        tStr = wxT("ODBC error during GetColumns()\n\n");
+        wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                     wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
         return;
     }
 
@@ -1757,7 +2352,7 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], wxChar *pWh
 
     pQueryHintMsg->SetLabel(langQRY_EQ);
 
-    pQuerySqlWhereMtxt->SetValue(pWhere);
+    pQuerySqlWhereMtxt->SetValue(pWhere.c_str());
 
     wxEndBusyCursor();
 
@@ -1955,7 +2550,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
         if (!ValidateWhereClause())
             return;
         // Copy the where clause to the output buffer and exit
-        wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue());
+        pWhere = pQuerySqlWhereMtxt->GetValue();
         Close();
         return;
     }  // Done button
@@ -1985,17 +2580,9 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
 void CqueryDlg::OnCloseWindow(wxCloseEvent& event)
 {
     // Clean up
-    if (colInf)
-    {
-        delete [] colInf;
-        colInf = 0;
-    }
+    wxDELETEA(colInf);
 
-    if (dbTable)
-    {
-        delete dbTable;
-        dbTable = 0;
-    }
+    wxDELETE(dbTable);
 
     GetParent()->SetFocus();
     while (wxIsBusy())
@@ -2122,11 +2709,12 @@ void CqueryDlg::ProcessCountBtn()
     if (!ValidateWhereClause())
         return;
 
-    if (dbTable == 0)  // wxDbTable object needs to be created and opened
+    if (!dbTable)  // wxDbTable object needs to be created and opened
     {
-        if (!(dbTable = new wxDbTable(pDB, masterTableName, 0, wxT(""),
-                                      !wxDB_QUERY_ONLY, 
-                                      wxGetApp().DbConnectInf->GetDefaultDir())))
+        dbTable = new wxDbTable(pDB, masterTableName, 0, wxT(""),
+                                !wxDB_QUERY_ONLY, 
+                                wxGetApp().DbConnectInf->GetDefaultDir());
+        if (!dbTable)
         {
             wxMessageBox(wxT("Memory allocation failed creating a wxDbTable object."),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
             return;
@@ -2134,9 +2722,9 @@ void CqueryDlg::ProcessCountBtn()
         if (!dbTable->Open())
         {
             wxString tStr;
-            tStr  = wxT("ODBC error during Open()\n\n");
-            tStr += GetExtendedDBErrorMsg(dbTable->GetDb(),__FILE__,__LINE__);
-            wxMessageBox(tStr,wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+            tStr = wxT("ODBC error during Open()\n\n");
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
             return;
         }
     }
@@ -2194,6 +2782,462 @@ bool CqueryDlg::ValidateWhereClause()
 
 
 
+void DisplayDbDiagnostics(wxDb *pDb)
+{
+    wxString s, t;
+    bool comma = FALSE;
+
+    s = langDBINF_DB_NAME;
+    s += pDb->dbInf.dbmsName;
+    s += "\n";
+
+    s += langDBINF_DB_VER;
+    s += pDb->dbInf.dbmsVer;
+    s += "\n";
+
+    s += langDBINF_DRIVER_NAME;
+    s += pDb->dbInf.driverName;
+    s += "\n";
+
+    s += langDBINF_DRIVER_ODBC_VER;
+    s += pDb->dbInf.odbcVer;
+    s += "\n";
+
+    s += langDBINF_DRIVER_MGR_ODBC_VER;
+    s += pDb->dbInf.drvMgrOdbcVer;
+    s += "\n";
+
+    s += langDBINF_DRIVER_VER;
+    s += pDb->dbInf.driverVer;
+    s += "\n";
+
+    s += langDBINF_SERVER_NAME;
+    s += pDb->dbInf.serverName;
+    s += "\n";
+
+    s += langDBINF_FILENAME;
+    s += pDb->dbInf.databaseName;
+    s += "\n";
+
+    s += langDBINF_OUTER_JOINS;
+    s += pDb->dbInf.outerJoins;
+    s += "\n";
+
+    s += langDBINF_STORED_PROC;
+    s += pDb->dbInf.procedureSupport;
+    s += "\n";
+
+    if (pDb->dbInf.maxConnections)
+        t.sprintf("%s%d\n", langDBINF_MAX_HDBC, pDb->dbInf.maxConnections);
+    else
+        t.sprintf("%s%s\n", langDBINF_MAX_HDBC, langDBINF_UNLIMITED);
+    s += t;
+
+    if (pDb->dbInf.maxStmts)
+        t.sprintf("%s%d\n", langDBINF_MAX_HSTMT, pDb->dbInf.maxStmts);
+    else
+        t.sprintf("%s%s\n", langDBINF_MAX_HSTMT, langDBINF_UNLIMITED);
+    s += t;
+
+    s += langDBINF_API_LVL;
+    switch(pDb->dbInf.apiConfLvl)
+    {
+        case SQL_OAC_NONE:  s += langDBINF_NONE;        break;
+        case SQL_OAC_LEVEL1:    s += langDBINF_LEVEL1;  break;
+        case SQL_OAC_LEVEL2:    s += langDBINF_LEVEL2;  break;
+    }
+    s += "\n";
+
+    s += langDBINF_CLI_LVL;
+    switch(pDb->dbInf.cliConfLvl)
+    {
+        case SQL_OSCC_NOT_COMPLIANT:    s += langDBINF_NOT_COMPLIANT;   break;
+        case SQL_OSCC_COMPLIANT:        s += langDBINF_COMPLIANT;           break;
+    }
+    s += "\n";
+
+    s += langDBINF_SQL_LVL;
+    switch(pDb->dbInf.sqlConfLvl)
+    {
+        case SQL_OSC_MINIMUM:   s += langDBINF_MIN_GRAMMAR; break;
+        case SQL_OSC_CORE:      s += langDBINF_CORE_GRAMMAR;    break;
+        case SQL_OSC_EXTENDED:  s += langDBINF_EXT_GRAMMAR; break;
+    }
+    s += "\n";
+
+    s += langDBINF_COMMIT_BEHAVIOR;
+    switch(pDb->dbInf.cursorCommitBehavior)
+    {
+        case SQL_CB_DELETE:     s += langDBINF_DELETE_CURSORS;  break;
+        case SQL_CB_CLOSE:      s += langDBINF_CLOSE_CURSORS;       break;
+        case SQL_CB_PRESERVE:   s += langDBINF_PRESERVE_CURSORS;    break;
+    }
+    s += "\n";
+
+    s += langDBINF_ROLLBACK_BEHAVIOR;
+    switch(pDb->dbInf.cursorRollbackBehavior)
+    {
+        case SQL_CB_DELETE:     s += langDBINF_DELETE_CURSORS;  break;
+        case SQL_CB_CLOSE:      s += langDBINF_CLOSE_CURSORS;       break;
+        case SQL_CB_PRESERVE:   s += langDBINF_PRESERVE_CURSORS;    break;
+    }
+    s += "\n";
+
+    s += langDBINF_SUPP_NOT_NULL;
+    switch(pDb->dbInf.supportNotNullClause)
+    {
+        case SQL_NNC_NULL:      s += langNO;    break;
+        case SQL_NNC_NON_NULL:  s += langYES;   break;
+    }
+    s += "\n";
+
+    s += langDBINF_SUPP_IEF;
+    s += pDb->dbInf.supportIEF;
+    s += "\n";
+
+    // DEFAULT setting for "Transaction Isolation Level"
+    s += langDBINF_TXN_ISOLATION;
+    switch(pDb->dbInf.txnIsolation)
+    {
+        case SQL_TXN_READ_UNCOMMITTED:  s += langDBINF_READ_UNCOMMITTED;    break;
+        case SQL_TXN_READ_COMMITTED:        s += langDBINF_READ_COMMITTED;  break;
+        case SQL_TXN_REPEATABLE_READ:       s += langDBINF_REPEATABLE_READ; break;
+        case SQL_TXN_SERIALIZABLE:          s += langDBINF_SERIALIZABLE;        break;
+#ifdef ODBC_V20
+        case SQL_TXN_VERSIONING:            s += langDBINF_VERSIONING;          break;
+#endif
+    }
+    s += "\n";
+
+    // CURRENT setting for "Transaction Isolation Level"
+    long txnIsoLvl;
+    s += langDBINF_TXN_ISOLATION_CURR;
+    if (SQLGetConnectOption(pDb->GetHDBC(),SQL_TXN_ISOLATION,&txnIsoLvl) == SQL_SUCCESS)
+    {
+        switch(txnIsoLvl)
+        {
+            case SQL_TXN_READ_UNCOMMITTED:  s += langDBINF_READ_UNCOMMITTED;    break;
+            case SQL_TXN_READ_COMMITTED:        s += langDBINF_READ_COMMITTED;  break;
+            case SQL_TXN_REPEATABLE_READ:       s += langDBINF_REPEATABLE_READ; break;
+            case SQL_TXN_SERIALIZABLE:          s += langDBINF_SERIALIZABLE;        break;
+#ifdef ODBC_V20
+            case SQL_TXN_VERSIONING:            s += langDBINF_VERSIONING;          break;
+#endif
+        }
+    }
+    s += "\n";
+
+#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++;}
+    if (pDb->dbInf.txnIsolationOptions & SQL_TXN_READ_COMMITTED)
+        {if (comma++) s += ", "; s += langDBINF_READ_COMMITTED;}
+    if (pDb->dbInf.txnIsolationOptions & SQL_TXN_REPEATABLE_READ)
+        {if (comma++) s += ", "; s += langDBINF_REPEATABLE_READ;}
+    if (pDb->dbInf.txnIsolationOptions & SQL_TXN_SERIALIZABLE)
+        {if (comma++) s += ", "; s += langDBINF_SERIALIZABLE;}
+#ifdef ODBC_V20
+    if (pDb->dbInf.txnIsolationOptions & SQL_TXN_VERSIONING)
+        {if (comma++) s += ", "; s += langDBINF_VERSIONING;}
+#endif
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_FETCH_DIRS;
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_NEXT)
+        {s += langDBINF_NEXT; comma++;}
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_PRIOR)
+        {if (comma++) s += ", "; s += langDBINF_PREV;}
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_FIRST)
+        {if (comma++) s += ", "; s += langDBINF_FIRST;}
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_LAST)
+        {if (comma++) s += ", "; s += langDBINF_LAST;}
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_ABSOLUTE)
+        {if (comma++) s += ", "; s += langDBINF_ABSOLUTE;}
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_RELATIVE)
+        {if (comma++) s += ", "; s += langDBINF_RELATIVE;}
+#ifdef ODBC_V20
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_RESUME)
+        {if (comma++) s += ", "; s += langDBINF_RESUME;}
+#endif
+    if (pDb->dbInf.fetchDirections & SQL_FD_FETCH_BOOKMARK)
+        {if (comma++) s += ", "; s += langDBINF_BOOKMARK;}
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_LOCK_TYPES;
+    if (pDb->dbInf.lockTypes & SQL_LCK_NO_CHANGE)
+        {s += langDBINF_NO_CHANGE; comma++;}
+    if (pDb->dbInf.lockTypes & SQL_LCK_EXCLUSIVE)
+        {if (comma++) s += ", "; s += langDBINF_EXCLUSIVE;}
+    if (pDb->dbInf.lockTypes & SQL_LCK_UNLOCK)
+        {if (comma++) s += ", "; s += langDBINF_UNLOCK;}
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_POS_OPERS;
+    if (pDb->dbInf.posOperations & SQL_POS_POSITION)
+        {s += langDBINF_POSITION; comma++;}
+    if (pDb->dbInf.posOperations & SQL_POS_REFRESH)
+        {if (comma++) s += ", "; s += langDBINF_REFRESH;}
+    if (pDb->dbInf.posOperations & SQL_POS_UPDATE)
+        {if (comma++) s += ", "; s += langDBINF_UPD;}
+    if (pDb->dbInf.posOperations & SQL_POS_DELETE)
+        {if (comma++) s += ", "; s += langDBINF_DEL;}
+    if (pDb->dbInf.posOperations & SQL_POS_ADD)
+        {if (comma++) s += ", "; s += langDBINF_ADD;}
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_POS_STMTS;
+    if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_DELETE)
+        {s += langDBINF_POS_DEL; comma++;}
+    if (pDb->dbInf.posStmts & SQL_PS_POSITIONED_UPDATE)
+        {if (comma++) s += ", "; s += langDBINF_POS_UPD;}
+    if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE)
+        {if (comma++) s += ", "; s += langDBINF_SELECT_FOR_UPD;}
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_SCROLL_CONCURR;
+    if (pDb->dbInf.scrollConcurrency & SQL_SCCO_READ_ONLY)
+        {s += langDBINF_READ_ONLY; comma++;}
+    if (pDb->dbInf.scrollConcurrency & SQL_SCCO_LOCK)
+        {if (comma++) s += ", "; s += langDBINF_LOCK;}
+    if (pDb->dbInf.scrollConcurrency & SQL_SCCO_OPT_ROWVER)
+        {if (comma++) s += ", "; s += langDBINF_OPT_ROWVER;}
+    if (pDb->dbInf.scrollConcurrency & SQL_SCCO_OPT_VALUES)
+        {if (comma++) s += ", "; s += langDBINF_OPT_VALUES;}
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_SCROLL_OPTS;
+    if (pDb->dbInf.scrollOptions & SQL_SO_FORWARD_ONLY)
+        {s += langDBINF_FWD_ONLY; comma++;}
+    if (pDb->dbInf.scrollOptions & SQL_SO_STATIC)
+        {if (comma++) s += ", "; s += langDBINF_STATIC;}
+    if (pDb->dbInf.scrollOptions & SQL_SO_KEYSET_DRIVEN)
+        {if (comma++) s += ", "; s += langDBINF_KEYSET_DRIVEN;}
+    if (pDb->dbInf.scrollOptions & SQL_SO_DYNAMIC)
+        {if (comma++) s += ", "; s += langDBINF_DYNAMIC;}
+    if (pDb->dbInf.scrollOptions & SQL_SO_MIXED)
+        {if (comma++) s += ", "; s += langDBINF_MIXED;}
+    s += "\n";
+
+    comma = FALSE;
+    s += langDBINF_STATIC_SENS;
+    if (pDb->dbInf.staticSensitivity & SQL_SS_ADDITIONS)
+        {s += langDBINF_ADDITIONS; comma++;}
+    if (pDb->dbInf.staticSensitivity & SQL_SS_DELETIONS)
+        {if (comma++) s += ", "; s += langDBINF_DELETIONS;}
+    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;
+    switch(pDb->dbInf.txnCapable)
+    {
+        case SQL_TC_NONE:           s += langNO;                        break;
+        case SQL_TC_DML:            s += langDBINF_DML_ONLY;        break;
+        case SQL_TC_DDL_COMMIT: s += langDBINF_DDL_COMMIT;      break;
+        case SQL_TC_DDL_IGNORE: s += langDBINF_DDL_IGNORE;      break;
+        case SQL_TC_ALL:            s += langDBINF_DDL_AND_DML; break;
+    }
+    s += "\n";
+
+    t.sprintf("%s%d\n", langDBINF_LOGIN_TIMEOUT, pDb->dbInf.loginTimeout);
+    s += t;
+
+    // Oracle specific information
+    if (pDb->Dbms() == dbmsORACLE)
+    {
+        s += "\n";
+        s += langDBINF_ORACLE_BANNER;
+        s += "\n";
+
+        // Oracle cache hit ratio
+        SDWORD cb;
+        ULONG dbBlockGets;
+        pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'db block gets'");
+        pDb->GetNext();
+        if (pDb->GetData(1, SQL_C_ULONG, &dbBlockGets, 0, &cb))
+        {
+            t.sprintf("%s: %lu\n", langDBINF_DB_BLOCK_GETS, dbBlockGets);
+            s += t;
+        }
+
+        ULONG consistentGets;
+        pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'consistent gets'");
+        pDb->GetNext();
+        if (pDb->GetData(1, SQL_C_ULONG, &consistentGets, 0, &cb))
+        {
+            t.sprintf("%s: %lu\n", langDBINF_CONSISTENT_GETS, consistentGets);
+            s += t;
+        }
+
+        ULONG physReads;
+        pDb->ExecSql("SELECT VALUE FROM V$SYSSTAT WHERE NAME = 'physical reads'");
+        pDb->GetNext();
+        if (pDb->GetData(1, SQL_C_ULONG, &physReads, 0, &cb))
+        {
+            t.sprintf("%s: %lu\n", langDBINF_PHYSICAL_READS, physReads);
+            s += t;
+        }
+
+        ULONG hitRatio = (ULONG)((1.00 - ((float)physReads / (float)(dbBlockGets + consistentGets))) * 100.00);
+        t.sprintf("*** %s: %lu%%\n", langDBINF_CACHE_HIT_RATIO, hitRatio);
+        s += t;
+
+        // Tablespace information
+        s += "\n";
+        s += langDBINF_TABLESPACE_IO;
+        s += "\n";
+        ULONG physWrites;
+        char tablespaceName[257];
+        pDb->ExecSql("SELECT NAME,PHYRDS,PHYWRTS FROM V$DATAFILE, V$FILESTAT WHERE V$DATAFILE.FILE# = V$FILESTAT.FILE#");
+        while (pDb->GetNext())
+        {
+            pDb->GetData(1, SQL_C_CHAR,  tablespaceName, 257, &cb);
+            pDb->GetData(2, SQL_C_ULONG, &physReads,     0,   &cb);
+            pDb->GetData(3, SQL_C_ULONG, &physWrites,    0,   &cb);
+            t.sprintf("%s\n\t%s: %lu\t%s: %lu\n", tablespaceName,
+                langDBINF_PHYSICAL_READS, physReads, langDBINF_PHYSICAL_WRITES, physWrites);
+            s += t;
+        }
+
+        s += "\n";
+    }
+
+    wxLogMessage(s);
+
+}  // DisplayDbDiagnostics()
+
+#if wxUSE_NEW_GRID
+
+BEGIN_EVENT_TABLE(DbGridFrame, wxFrame)
+ //   EVT_CLOSE(DbGridFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+
+DbGridFrame::DbGridFrame(wxWindow *parent)
+    : wxFrame (parent, -1, wxT("Database Table"),
+               wxDefaultPosition, wxSize(400, 325))
+{
+    initialized = FALSE;
+}
+
+
+void DbGridFrame::OnCloseWindow(wxCloseEvent& event)
+{
+    this->Destroy();
+}
+
+
+bool DbGridFrame::Initialize()
+{
+    wxGrid *grid = new wxGrid(this, -1, wxDefaultPosition);
+
+    grid->RegisterDataType(wxGRID_VALUE_DATETIME,
+                             new wxGridCellDateTimeRenderer(_T("%d %b %Y")),
+                             new wxGridCellTextEditor);
+#ifdef CHOICEINT
+    grid->RegisterDataType(wxGRID_VALUE_CHOICEINT,
+                             new wxGridCellEnumRenderer,
+                             new wxGridCellEnumEditor);
+                             
+    wxString NativeLangChoice( wxString::Format("%s:%s,%s,%s,%s,%s",wxGRID_VALUE_CHOICEINT, 
+                            wxT("English"),
+                            wxT("French"),
+                            wxT("German"),
+                            wxT("Spanish"),
+                            wxT("Other") )); 
+#endif
+
+    // Columns must match the sequence specified in SetColDef() calls
+    wxDbGridColInfo* cols =
+        new wxDbGridColInfo( 0,wxGRID_VALUE_STRING,wxT("Name"),
+        new wxDbGridColInfo( 1,wxGRID_VALUE_STRING,wxT("Address 1"),
+        new wxDbGridColInfo( 2,wxGRID_VALUE_STRING,wxT("Address 2"),
+        new wxDbGridColInfo( 3,wxGRID_VALUE_STRING,wxT("City"),
+        new wxDbGridColInfo( 4,wxGRID_VALUE_STRING,wxT("State"),
+        new wxDbGridColInfo( 5,wxGRID_VALUE_STRING,wxT("PostCode"),
+        new wxDbGridColInfo( 6,wxGRID_VALUE_STRING,wxT("Country"),
+        new wxDbGridColInfo( 7,wxGRID_VALUE_DBAUTO,wxT("Join Date"),
+        new wxDbGridColInfo( 8,wxGRID_VALUE_BOOL,  wxT("Developer"),
+        new wxDbGridColInfo( 9,wxGRID_VALUE_NUMBER,wxT("Contributions"),
+        new wxDbGridColInfo(10,wxGRID_VALUE_NUMBER,wxT("Lines Of Code"),
+#ifdef CHOICEINT
+        new wxDbGridColInfo(11,NativeLangChoice,   wxT("Native Language"),NULL))))))))))));
+#else        
+        new wxDbGridColInfo(11,wxGRID_VALUE_NUMBER,wxT("Native Language"),NULL))))))))))));
+#endif
+
+    Ccontact *Contact = new Ccontact();
+    //wxGetApp().Contact
+
+    if (!Contact)
+    {
+        wxMessageBox(wxT("Unable to instantiate an instance of Ccontact"), wxT("Error..."), wxOK | wxICON_EXCLAMATION);
+        return FALSE;
+    }
+
+    if (!Contact->Open())
+    {
+        if (Contact->GetDb()->TableExists(CONTACT_TABLE_NAME, Contact->GetDb()->GetUsername(),
+                                          wxGetApp().DbConnectInf->GetDefaultDir()))
+        {
+            wxString tStr;
+            tStr.Printf(wxT("Unable to open the table '%s'.\n\n"),CONTACT_TABLE_NAME);
+            wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__FILE__,__LINE__),
+                         wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
+        }
+
+        return FALSE;
+    }
+
+    // Execute the following query using the cursor designated
+    // for full table query
+    Contact->SetRowMode(wxDbTable::WX_ROW_MODE_QUERY);
+
+    if (!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;
+    }
+
+    // No data has been read in from the database yet, so
+    // we need to initialize the data members to valid values
+    // so Fit() can correctly size the grid
+    Contact->Initialize();
+
+    wxDbGridTableBase* db = new wxDbGridTableBase(Contact, cols, wxUSE_QUERY, TRUE);
+
+    delete cols;
+
+    grid->SetTable(db,TRUE);
+    grid->SetMargins(0, 0);
+
+    grid->Fit();
+    wxSize size = grid->GetSize();
+    size.x += 10;
+    size.y += 10;
+    SetClientSize(size);
+    initialized = TRUE;
+    return TRUE;
+}  // DbGridFrame::Initialize()
+
+#endif // #if wxUSE_NEW_GRID
 
 /*
     TEST CODE FOR TESTING THE wxDbCreateDataSource() FUNCTION