X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/645889ad25eaa6e332463a6105a1dfd63d917d36..752cd08c659c7393bacbfe4305760f4ee58a8255:/demos/dbbrowse/doc.cpp diff --git a/demos/dbbrowse/doc.cpp b/demos/dbbrowse/doc.cpp index a78fc90847..0b05fc978b 100644 --- a/demos/dbbrowse/doc.cpp +++ b/demos/dbbrowse/doc.cpp @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------------------- // Name: doc.cpp // Purpose: Holds information for DBBrowser - (a do-it-yourself document) -// Author: Mark Johnson, mj10777@gmx.net +// Author: Mark Johnson // Modified by: 19990808.mj10777 // BJO : Bart A.M. JOURQUIN // Created: 19990808 @@ -33,7 +33,7 @@ //---------------------------------------------------------------------------------------- //-- Some Global Vars for all Files (extern in ?.h needed) ------------------------------- // Global structure for holding ODBC connection information -wxDbConnectInf DbConnectInf; +extern wxDbConnectInf DbConnectInf; //---------------------------------------------------------------------------------------- wxConfigBase *p_ProgramCfg; // All Config and Path information @@ -57,7 +57,7 @@ MainDoc::MainDoc() i_TabNr = 0; i_PageNr = 0; s_BColour = "WHEAT"; - ft_Doc = new wxFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT)); + ft_Doc = new wxFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT)); } //---------------------------------------------------------------------------------------- @@ -159,11 +159,12 @@ bool MainDoc::OnInitODBC() int i = 0; //--------------------------------------------------------------------------------------- // Initialize the ODBC Environment for Database Operations - - if (SQLAllocEnv(&DbConnectInf.Henv) != SQL_SUCCESS) + + if (!DbConnectInf.AllocHenv()) { return FALSE; } + //--------------------------------------------------------------------------------------- const char sep = 3; // separator character used in string between DSN ans DsDesc wxStringList s_SortDSNList, s_SortDsDescList; @@ -172,7 +173,7 @@ bool MainDoc::OnInitODBC() // The key will be removed after sorting wxString KeyString; //--------------------------------------------------------------------------------------- - while(wxDbGetDataSource(DbConnectInf.Henv, Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc))) + while(wxDbGetDataSource(DbConnectInf.GetHenv(), Dsn, sizeof(Dsn), DsDesc, sizeof(DsDesc))) { i_DSN++; // How many Dsn have we ? KeyString.Printf("%s%c%s",Dsn, sep, DsDesc); @@ -212,10 +213,9 @@ bool MainDoc::OnInitODBC() (db_Br+i)->pDoc = this; (db_Br+i)->i_Which = i; } - if (SQLFreeEnv(DbConnectInf.Henv) != SQL_SUCCESS) // BJO20000125 / MJ10777.20000309 : no & - { - // Error freeing environment handle - } + + DbConnectInf.FreeHenv(); + delete [] s_SortDSN; delete [] s_SortDsDesc; //---------------------------------------------------------------------------------------