diff options
-rw-r--r-- | compilerplugins/clang/mergeclasses.results | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/odbcconfig.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/odbcconfig.hxx | 52 |
3 files changed, 25 insertions, 54 deletions
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 147c46a0dcbf..8784c015cc0b 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -110,7 +110,6 @@ merge cppu::PropertySetMixinImpl with cppu::PropertySetMixin merge dbaccess::IPropertyContainer with dbaccess::OColumn merge dbaccess::IRefreshListener with dbaccess::OConnection merge dbaui::IEntryFilter with dbaui::(anonymous namespace)::FilterByEntryDataId -merge dbaui::OOdbcLibWrapper with dbaui::OOdbcEnumeration merge dbaui::SbaGridListener with dbaui::SbaXDataBrowserController merge dbmm::IMigrationProgress with dbmm::ProgressPage merge dbmm::IProgressConsumer with dbmm::ProgressDelegator diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx index b04aa698db60..e6308c7557a2 100644 --- a/dbaccess/source/ui/dlg/odbcconfig.cxx +++ b/dbaccess/source/ui/dlg/odbcconfig.cxx @@ -69,16 +69,8 @@ typedef SQLRETURN (SQL_API* TSQLDataSources) (SQLHENV EnvironmentHandle, SQLUSMA #endif // OOdbcLibWrapper -#ifdef HAVE_ODBC_SUPPORT -OOdbcLibWrapper::OOdbcLibWrapper() - :m_pOdbcLib(NULL) -{ - -} - -#endif -bool OOdbcLibWrapper::load(const sal_Char* _pLibPath) +bool OOdbcEnumeration::load(const sal_Char* _pLibPath) { m_sLibPath = OUString::createFromAscii(_pLibPath); #ifdef HAVE_ODBC_SUPPORT @@ -90,7 +82,7 @@ bool OOdbcLibWrapper::load(const sal_Char* _pLibPath) #endif } -void OOdbcLibWrapper::unload() +void OOdbcEnumeration::unload() { #ifdef HAVE_ODBC_SUPPORT if (isLoaded()) @@ -101,18 +93,12 @@ void OOdbcLibWrapper::unload() #endif } -oslGenericFunction OOdbcLibWrapper::loadSymbol(const sal_Char* _pFunctionName) +oslGenericFunction OOdbcEnumeration::loadSymbol(const sal_Char* _pFunctionName) { return osl_getFunctionSymbol(m_pOdbcLib, OUString::createFromAscii(_pFunctionName).pData); } -OOdbcLibWrapper::~OOdbcLibWrapper() -{ - unload(); - -} -// OOdbcEnumeration struct OdbcTypesImpl { #ifdef HAVE_ODBC_SUPPORT @@ -124,8 +110,9 @@ struct OdbcTypesImpl }; OOdbcEnumeration::OOdbcEnumeration() + :m_pOdbcLib(NULL) #ifdef HAVE_ODBC_SUPPORT - :m_pAllocHandle(NULL) + ,m_pAllocHandle(NULL) ,m_pFreeHandle(NULL) ,m_pSetEnvAttr(NULL) ,m_pDataSources(NULL) @@ -161,9 +148,10 @@ OOdbcEnumeration::~OOdbcEnumeration() { freeEnv(); delete m_pImpl; - + unload(); } +// OOdbcEnumeration bool OOdbcEnumeration::allocEnv() { OSL_ENSURE(isLoaded(), "OOdbcEnumeration::allocEnv: not loaded!"); diff --git a/dbaccess/source/ui/dlg/odbcconfig.hxx b/dbaccess/source/ui/dlg/odbcconfig.hxx index 3059b1dcf06b..3142f5cd9b8a 100644 --- a/dbaccess/source/ui/dlg/odbcconfig.hxx +++ b/dbaccess/source/ui/dlg/odbcconfig.hxx @@ -38,42 +38,13 @@ namespace dbaui { -// OOdbcLibWrapper -/** base for helper classes wrapping functionality from an ODBC library -*/ -class OOdbcLibWrapper -{ - oslModule m_pOdbcLib; // the library handle - OUString m_sLibPath; // the path to the library - -public: -#ifdef HAVE_ODBC_SUPPORT - bool isLoaded() const { return NULL != m_pOdbcLib; } -#else - sal_Bool isLoaded() const { return sal_False; } -#endif - OUString getLibraryName() const { return m_sLibPath; } - -protected: -#ifndef HAVE_ODBC_SUPPORT - OOdbcLibWrapper() : m_pOdbcLib(NULL) { } -#else - OOdbcLibWrapper(); -#endif - ~OOdbcLibWrapper(); - - oslGenericFunction loadSymbol(const sal_Char* _pFunctionName); - - /// load the lib - bool load(const sal_Char* _pLibPath); - /// unload the lib - void unload(); -}; - // OOdbcEnumeration struct OdbcTypesImpl; -class OOdbcEnumeration : public OOdbcLibWrapper +class OOdbcEnumeration { + oslModule m_pOdbcLib; // the library handle + OUString m_sLibPath; // the path to the library + #ifdef HAVE_ODBC_SUPPORT // entry points for ODBC administration oslGenericFunction m_pAllocHandle; @@ -90,11 +61,24 @@ public: OOdbcEnumeration(); ~OOdbcEnumeration(); +#ifdef HAVE_ODBC_SUPPORT + bool isLoaded() const { return NULL != m_pOdbcLib; } +#else + bool isLoaded() const { return false; } +#endif + OUString getLibraryName() const { return m_sLibPath; } + void getDatasourceNames(StringBag& _rNames); protected: + oslGenericFunction loadSymbol(const sal_Char* _pFunctionName); + + /// load the lib + bool load(const sal_Char* _pLibPath); + /// unload the lib + void unload(); /// ensure that an ODBC environment is allocated - bool allocEnv(); + bool allocEnv(); /// free any allocated ODBC environment void freeEnv(); }; |