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: TConnection.hxx,v $
10 * $Revision: 1.13.56.1 $
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 ************************************************************************/
30 #ifndef CONNECTIVITY_CONNECTION_HXX
31 #define CONNECTIVITY_CONNECTION_HXX
33 #include <rtl/textenc.h>
34 #include <com/sun/star/lang/DisposedException.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
38 #include <com/sun/star/sdbc/XConnection.hpp>
39 #include <cppuhelper/compbase4.hxx>
40 #include "propertyids.hxx"
41 #include "connectivity/CommonTools.hxx"
42 #include "connectivity/dbtoolsdllapi.hxx"
43 #include "resource/sharedresources.hxx"
45 namespace connectivity
47 typedef ::cppu::WeakComponentImplHelper4
< ::com::sun::star::sdbc::XConnection
,
48 ::com::sun::star::sdbc::XWarningsSupplier
,
49 ::com::sun::star::lang::XServiceInfo
,
50 ::com::sun::star::lang::XUnoTunnel
51 > OMetaConnection_BASE
;
53 typedef ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> TConditions
;
55 class OOO_DLLPUBLIC_DBTOOLS OMetaConnection
: public OMetaConnection_BASE
58 ::osl::Mutex m_aMutex
;
59 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>
61 connectivity::OWeakRefArray m_aStatements
; // vector containing a list
62 // of all the Statement objects
63 // for this Connection
64 ::rtl::OUString m_sURL
;
65 rtl_TextEncoding m_nTextEncoding
; // the encoding which is used for all text conversions
66 ::com::sun::star::uno::WeakReference
< ::com::sun::star::sdbc::XDatabaseMetaData
>
68 SharedResources m_aResources
;
71 static ::dbtools::OPropertyMap
& getPropMap();
75 inline rtl_TextEncoding
getTextEncoding() const { return m_nTextEncoding
; }
76 inline ::rtl::OUString
getURL() const { return m_sURL
; }
77 inline void setURL(const ::rtl::OUString
& _rsUrl
) { m_sURL
= _rsUrl
; }
78 void throwGenericSQLException( sal_uInt16 _nErrorResourceId
,const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _xContext
);
79 const SharedResources
& getResources() const { return m_aResources
;}
81 inline void setConnectionInfo(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& _aInfo
) { m_aConnectionInfo
= _aInfo
; }
82 inline const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>&
83 getConnectionInfo() const { return m_aConnectionInfo
; }
86 virtual void SAL_CALL
disposing(void);
89 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw (::com::sun::star::uno::RuntimeException
);
90 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
93 #endif // CONNECTIVITY_CONNECTION_HXX