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 _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
29 #if defined(WNT) && defined(HAVE_ODBC_SUPPORT)
30 #define HAVE_ODBC_ADMINISTRATION
33 #include <tools/link.hxx>
34 #include <osl/module.h>
38 //.........................................................................
41 //.........................................................................
43 //=========================================================================
45 //=========================================================================
46 /** base for helper classes wrapping functionality from an ODBC library
50 oslModule m_pOdbcLib
; // the library handle
51 OUString m_sLibPath
; // the path to the library
54 #ifdef HAVE_ODBC_SUPPORT
55 sal_Bool
isLoaded() const { return NULL
!= m_pOdbcLib
; }
57 sal_Bool
isLoaded() const { return sal_False
; }
59 OUString
getLibraryName() const { return m_sLibPath
; }
62 #ifndef HAVE_ODBC_SUPPORT
63 OOdbcLibWrapper() : m_pOdbcLib(NULL
) { }
69 oslGenericFunction
loadSymbol(const sal_Char
* _pFunctionName
);
72 sal_Bool
load(const sal_Char
* _pLibPath
);
77 //=========================================================================
79 //=========================================================================
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
;
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
99 void getDatasourceNames(StringBag
& _rNames
);
102 /// ensure that an ODBC environment is allocated
104 /// free any allocated ODBC environment
108 //=========================================================================
110 //=========================================================================
111 #ifdef HAVE_ODBC_ADMINISTRATION
112 class ProcessTerminationWait
;
113 class OOdbcManagement
115 ::std::auto_ptr
< ProcessTerminationWait
> m_pProcessWait
;
116 Link m_aAsyncFinishCallback
;
119 OOdbcManagement( const Link
& _rAsyncFinishCallback
);
122 bool manageDataSources_async();
123 bool isRunning() const;
127 //.........................................................................
129 //.........................................................................
131 #endif // _DBAUI_ODBC_CONFIG_HXX_
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */