bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / dlg / odbcconfig.hxx
blob1feeab014c408fe75f4ff3bd07db5df54ff17e77
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 #ifndef _DBAUI_ODBC_CONFIG_HXX_
21 #define _DBAUI_ODBC_CONFIG_HXX_
23 #include "commontypes.hxx"
25 #if defined(WNT) || (defined (UNX) && !defined(ANDROID) && !defined(IOS))
26 #define HAVE_ODBC_SUPPORT
27 #endif
29 #if defined(WNT) && defined(HAVE_ODBC_SUPPORT)
30 #define HAVE_ODBC_ADMINISTRATION
31 #endif
33 #include <tools/link.hxx>
34 #include <osl/module.h>
36 #include <memory>
38 //.........................................................................
39 namespace dbaui
41 //.........................................................................
43 //=========================================================================
44 //= OOdbcLibWrapper
45 //=========================================================================
46 /** base for helper classes wrapping functionality from an ODBC library
48 class OOdbcLibWrapper
50 oslModule m_pOdbcLib; // the library handle
51 OUString m_sLibPath; // the path to the library
53 public:
54 #ifdef HAVE_ODBC_SUPPORT
55 sal_Bool isLoaded() const { return NULL != m_pOdbcLib; }
56 #else
57 sal_Bool isLoaded() const { return sal_False; }
58 #endif
59 OUString getLibraryName() const { return m_sLibPath; }
61 protected:
62 #ifndef HAVE_ODBC_SUPPORT
63 OOdbcLibWrapper() : m_pOdbcLib(NULL) { }
64 #else
65 OOdbcLibWrapper();
66 #endif
67 ~OOdbcLibWrapper();
69 oslGenericFunction loadSymbol(const sal_Char* _pFunctionName);
71 /// load the lib
72 sal_Bool load(const sal_Char* _pLibPath);
73 /// unload the lib
74 void unload();
77 //=========================================================================
78 //= OOdbcEnumeration
79 //=========================================================================
80 struct OdbcTypesImpl;
81 class OOdbcEnumeration : public OOdbcLibWrapper
83 #ifdef HAVE_ODBC_SUPPORT
84 // entry points for ODBC administration
85 oslGenericFunction m_pAllocHandle;
86 oslGenericFunction m_pFreeHandle;
87 oslGenericFunction m_pSetEnvAttr;
88 oslGenericFunction m_pDataSources;
90 #endif
91 OdbcTypesImpl* m_pImpl;
92 // needed because we can't have a member of type SQLHANDLE: this would require us to include the respective
93 // ODBC file, which would lead to a lot of conflicts with other includes
95 public:
96 OOdbcEnumeration();
97 ~OOdbcEnumeration();
99 void getDatasourceNames(StringBag& _rNames);
101 protected:
102 /// ensure that an ODBC environment is allocated
103 sal_Bool allocEnv();
104 /// free any allocated ODBC environment
105 void freeEnv();
108 //=========================================================================
109 //= OOdbcManagement
110 //=========================================================================
111 #ifdef HAVE_ODBC_ADMINISTRATION
112 class ProcessTerminationWait;
113 class OOdbcManagement
115 ::std::auto_ptr< ProcessTerminationWait > m_pProcessWait;
116 Link m_aAsyncFinishCallback;
118 public:
119 OOdbcManagement( const Link& _rAsyncFinishCallback );
120 ~OOdbcManagement();
122 bool manageDataSources_async();
123 bool isRunning() const;
125 #endif
127 //.........................................................................
128 } // namespace dbaui
129 //.........................................................................
131 #endif // _DBAUI_ODBC_CONFIG_HXX_
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */