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 .
22 #if defined(_WIN32) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
23 #define HAVE_ODBC_SUPPORT
26 #if defined(_WIN32) && defined(HAVE_ODBC_SUPPORT)
27 #define HAVE_ODBC_ADMINISTRATION
30 #include <rtl/ustring.hxx>
31 #include <tools/link.hxx>
32 #include <osl/module.h>
42 class OOdbcEnumeration final
44 oslModule m_pOdbcLib
; // the library handle
45 OUString m_sLibPath
; // the path to the library
47 #ifdef HAVE_ODBC_SUPPORT
48 // entry points for ODBC administration
49 oslGenericFunction m_pAllocHandle
;
50 oslGenericFunction m_pFreeHandle
;
51 oslGenericFunction m_pSetEnvAttr
;
52 oslGenericFunction m_pDataSources
;
55 std::unique_ptr
<OdbcTypesImpl
> m_pImpl
;
56 // needed because we can't have a member of type SQLHANDLE: this would require us to include the respective
57 // ODBC file, which would lead to a lot of conflicts with other includes
63 #ifdef HAVE_ODBC_SUPPORT
64 bool isLoaded() const { return nullptr != m_pOdbcLib
; }
66 bool isLoaded() const { return false; }
68 const OUString
& getLibraryName() const { return m_sLibPath
; }
70 void getDatasourceNames(std::set
<OUString
>& _rNames
);
73 oslGenericFunction
loadSymbol(const char* _pFunctionName
);
76 bool load(const char* _pLibPath
);
79 /// ensure that an ODBC environment is allocated
81 /// free any allocated ODBC environment
86 #ifdef HAVE_ODBC_ADMINISTRATION
87 class ProcessTerminationWait
;
90 std::unique_ptr
< ProcessTerminationWait
> m_pProcessWait
;
91 Link
<void*,void> m_aAsyncFinishCallback
;
94 explicit OOdbcManagement( const Link
<void*,void>& _rAsyncFinishCallback
);
97 bool manageDataSources_async();
98 bool isRunning() const;
99 void disableCallback();
100 void receivedCallback();
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */