tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / dbaccess / source / ui / dlg / odbcconfig.hxx
blob16177ad8a8103613bde70e3eac5a1f0b569b1b7d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #if defined(_WIN32) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
23 #define HAVE_ODBC_SUPPORT
24 #endif
26 #if defined(_WIN32) && defined(HAVE_ODBC_SUPPORT)
27 #define HAVE_ODBC_ADMINISTRATION
28 #endif
30 #include <rtl/ustring.hxx>
31 #include <tools/link.hxx>
32 #include <osl/module.h>
34 #include <memory>
35 #include <set>
37 namespace dbaui
40 // OOdbcEnumeration
41 struct OdbcTypesImpl;
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;
54 #endif
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
59 public:
60 OOdbcEnumeration();
61 ~OOdbcEnumeration();
63 #ifdef HAVE_ODBC_SUPPORT
64 bool isLoaded() const { return nullptr != m_pOdbcLib; }
65 #else
66 bool isLoaded() const { return false; }
67 #endif
68 const OUString& getLibraryName() const { return m_sLibPath; }
70 void getDatasourceNames(std::set<OUString>& _rNames);
72 private:
73 oslGenericFunction loadSymbol(const char* _pFunctionName);
75 /// load the lib
76 bool load(const char* _pLibPath);
77 /// unload the lib
78 void unload();
79 /// ensure that an ODBC environment is allocated
80 bool allocEnv();
81 /// free any allocated ODBC environment
82 void freeEnv();
85 // OOdbcManagement
86 #ifdef HAVE_ODBC_ADMINISTRATION
87 class ProcessTerminationWait;
88 class OOdbcManagement
90 std::unique_ptr< ProcessTerminationWait > m_pProcessWait;
91 Link<void*,void> m_aAsyncFinishCallback;
93 public:
94 explicit OOdbcManagement( const Link<void*,void>& _rAsyncFinishCallback );
95 ~OOdbcManagement();
97 bool manageDataSources_async();
98 bool isRunning() const;
99 void disableCallback();
100 void receivedCallback();
102 #endif
104 } // namespace dbaui
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */