1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: odbcconfig.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_ODBC_CONFIG_HXX_
32 #define _DBAUI_ODBC_CONFIG_HXX_
34 #include "commontypes.hxx"
36 #if defined(WIN) || defined(WNT) || defined (UNX) || defined (OS2)
37 #define HAVE_ODBC_SUPPORT
40 #if ( defined(WIN) || defined(WNT) || defined (OS2) ) && defined(HAVE_ODBC_SUPPORT)
41 #define HAVE_ODBC_ADMINISTRATION
44 #include <tools/link.hxx>
45 #include <osl/module.h>
49 //.........................................................................
52 //.........................................................................
54 //=========================================================================
56 //=========================================================================
57 /** base for helper classes wrapping functionality from an ODBC library
61 oslModule m_pOdbcLib
; // the library handle
62 ::rtl::OUString m_sLibPath
; // the path to the library
65 #ifdef HAVE_ODBC_SUPPORT
66 sal_Bool
isLoaded() const { return NULL
!= m_pOdbcLib
; }
68 sal_Bool
isLoaded() const { return sal_False
; }
70 ::rtl::OUString
getLibraryName() const { return m_sLibPath
; }
73 #ifndef HAVE_ODBC_SUPPORT
74 OOdbcLibWrapper() : m_pOdbcLib(NULL
) { }
80 oslGenericFunction
loadSymbol(const sal_Char
* _pFunctionName
);
83 sal_Bool
load(const sal_Char
* _pLibPath
);
88 //=========================================================================
90 //=========================================================================
92 class OOdbcEnumeration
: public OOdbcLibWrapper
94 #ifdef HAVE_ODBC_SUPPORT
95 // entry points for ODBC administration
96 oslGenericFunction m_pAllocHandle
;
97 oslGenericFunction m_pFreeHandle
;
98 oslGenericFunction m_pSetEnvAttr
;
99 oslGenericFunction m_pDataSources
;
102 OdbcTypesImpl
* m_pImpl
;
103 // needed because we can't have a member of type SQLHANDLE: this would require us to include the respective
104 // ODBC file, which would lead to a lot of conflicts with other includes
110 void getDatasourceNames(StringBag
& _rNames
);
113 /// ensure that an ODBC environment is allocated
115 /// free any allocated ODBC environment
119 //=========================================================================
121 //=========================================================================
122 #ifdef HAVE_ODBC_ADMINISTRATION
123 class ProcessTerminationWait
;
124 class OOdbcManagement
126 ::std::auto_ptr
< ProcessTerminationWait
> m_pProcessWait
;
127 Link m_aAsyncFinishCallback
;
130 OOdbcManagement( const Link
& _rAsyncFinishCallback
);
133 bool manageDataSources_async();
134 bool isRunning() const;
138 //.........................................................................
140 //.........................................................................
142 #endif // _DBAUI_ODBC_CONFIG_HXX_