1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
23 #include "commontypes.hxx"
25 #if defined(WNT) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
26 #define HAVE_ODBC_SUPPORT
29 #if defined(WNT) && defined(HAVE_ODBC_SUPPORT)
30 #define HAVE_ODBC_ADMINISTRATION
33 #include <tools/link.hxx>
34 #include <osl/module.h>
42 /** base for helper classes wrapping functionality from an ODBC library
46 oslModule m_pOdbcLib
; // the library handle
47 OUString m_sLibPath
; // the path to the library
50 #ifdef HAVE_ODBC_SUPPORT
51 bool isLoaded() const { return NULL
!= m_pOdbcLib
; }
53 sal_Bool
isLoaded() const { return sal_False
; }
55 OUString
getLibraryName() const { return m_sLibPath
; }
58 #ifndef HAVE_ODBC_SUPPORT
59 OOdbcLibWrapper() : m_pOdbcLib(NULL
) { }
65 oslGenericFunction
loadSymbol(const sal_Char
* _pFunctionName
);
68 bool load(const sal_Char
* _pLibPath
);
75 class OOdbcEnumeration
: public OOdbcLibWrapper
77 #ifdef HAVE_ODBC_SUPPORT
78 // entry points for ODBC administration
79 oslGenericFunction m_pAllocHandle
;
80 oslGenericFunction m_pFreeHandle
;
81 oslGenericFunction m_pSetEnvAttr
;
82 oslGenericFunction m_pDataSources
;
85 OdbcTypesImpl
* m_pImpl
;
86 // needed because we can't have a member of type SQLHANDLE: this would require us to include the respective
87 // ODBC file, which would lead to a lot of conflicts with other includes
93 void getDatasourceNames(StringBag
& _rNames
);
96 /// ensure that an ODBC environment is allocated
98 /// free any allocated ODBC environment
103 #ifdef HAVE_ODBC_ADMINISTRATION
104 class ProcessTerminationWait
;
105 class OOdbcManagement
107 ::std::unique_ptr
< ProcessTerminationWait
> m_pProcessWait
;
108 Link
<> m_aAsyncFinishCallback
;
111 OOdbcManagement( const Link
<>& _rAsyncFinishCallback
);
114 bool manageDataSources_async();
115 bool isRunning() const;
121 #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ODBCCONFIG_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */