From 5ceaa05a922649caadc533ac53eda2488e6e03a2 Mon Sep 17 00:00:00 2001 From: George Tasker Date: Mon, 10 Apr 2000 12:45:26 +0000 Subject: [PATCH] Sample was missing the call to SQLFreeEnv() required to release the ODBC environment handle memory git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/db/dbtest.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index b1f9bdbde5..a87b5566ac 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -278,7 +278,13 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event) if (pEditorDlg->Close()) pEditorDlg = NULL; else + { event.Veto(); + return; + } + + // Cleans up the environment space allocated for the SQL/ODBC connection handle + SQLFreeEnv(DbConnectInf.Henv); this->Destroy(); @@ -471,7 +477,7 @@ bool Ccontact::FetchByName(char *name) { whereStr.Printf("NAME = '%s'",name); where = (char*) (const char*) this->whereStr; - orderBy = 0; + orderBy = ""; if (!Query()) return(FALSE); @@ -639,7 +645,7 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) Contact->where = (char*) (const char*) Contact->whereStr; } else - Contact->where = 0; + Contact->where = ""; // 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. @@ -807,7 +813,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) Contact->where = (char*) (const char*) Contact->whereStr; } else - Contact->where = 0; + Contact->where = ""; if (!Contact->Query()) { @@ -2048,7 +2054,7 @@ void CqueryDlg::ProcessCountBtn() ULONG whereCnt = dbTable->Count(); // Count() of all records in the table - dbTable->where = 0; + dbTable->where = ""; ULONG totalCnt = dbTable->Count(); if (whereCnt > 0 || totalCnt == 0)