]> git.saurik.com Git - wxWidgets.git/commitdiff
Added compile-time check to be sure that wxUSE_ODBC is set to 1 before attempting...
authorGeorge Tasker <gtasker@allenbrook.com>
Fri, 18 May 2001 18:32:33 +0000 (18:32 +0000)
committerGeorge Tasker <gtasker@allenbrook.com>
Fri, 18 May 2001 18:32:33 +0000 (18:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10212 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

demos/dbbrowse/browsedb.cpp
samples/db/dbtest.cpp

index b8b20b7a7d60b1ebaceebdd86b3db8324efb7738..3506574c26838194f81c225953ea6bccc858847a 100644 (file)
 // - darf nur einmal im Projekte definiert werden ?? Extra Databasse Klasse ?
 wxDbConnectInf DbConnectInf;           // Für DBase
 
+#if wxUSE_ODBC
+  #error Demo cannot be compiled unless setup.h has wxUSE_ODBC set to 1
+#endif
+
 //----------------------------------------------------------------------------------------
 extern WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList;       /* from db.cpp, used in getting back error results from db connections */
 
index 64219c122d171fd8809b264e842e7b8aeac183ec..89b4c14ffb413bac32b3d208481d39c32e23f40b 100644 (file)
@@ -54,6 +54,12 @@ 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 */
 
+
+#if !wxUSE_ODBC
+  #error Sample cannot be compiled unless setup.h has wxUSE_ODBC set to 1
+#endif
+
+
 const char *GetExtendedDBErrorMsg(wxDb *pDb, char *ErrFile, int ErrLine)
 {
     static wxString msg;
@@ -1171,11 +1177,21 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
     if (widgetName == pDataTypesBtn->GetName())
     {
         CheckSupportForAllDataTypes(wxGetApp().READONLY_DB);
+
         return;
     }  // Data types Button
 
     if (widgetName == pDbDiagsBtn->GetName())
     {
+/*
+strcpy(wxGetApp().Contact->Addr1,"12345678901234567890");
+//wxString sqlStmt = "UPDATE CONTACTS set ADDRESS1='1234567890ABCEFG' where NAME='12345'";
+//if (wxGetApp().Contact->GetDb()->ExecSql(sqlStmt))
+if (wxGetApp().Contact->UpdateWhere("NAME = '12345'"))
+wxGetApp().Contact->GetDb()->CommitTrans();
+else
+wxGetApp().Contact->GetDb()->RollbackTrans();
+*/
         DisplayDbDiagnostics(wxGetApp().READONLY_DB);
         return;
     }
@@ -1602,7 +1618,7 @@ bool CeditorDlg::Save()
                 }
                 else
                 {
-                    // Some other unexpexted error occurred
+                    // Some other unexpected error occurred
                     wxString tStr;
                     tStr  = wxT("Database insert failed\n\n");
                     tStr += GetExtendedDBErrorMsg(wxGetApp().Contact->GetDb(),__FILE__,__LINE__);
@@ -1612,6 +1628,7 @@ bool CeditorDlg::Save()
         }
         else  // mode == mEdit
         {
+            wxGetApp().Contact->GetDb()->RollbackTrans();
             wxGetApp().Contact->whereStr.Printf("NAME = '%s'",saveName.c_str());
             if (!wxGetApp().Contact->UpdateWhere(wxGetApp().Contact->whereStr))
             {