1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef CONNECTIVITY_CONNECTION_HXX
28 #define CONNECTIVITY_CONNECTION_HXX
29 
30 #include <rtl/textenc.h>
31 #include <com/sun/star/lang/DisposedException.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/lang/XUnoTunnel.hpp>
34 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
35 #include <com/sun/star/sdbc/XConnection.hpp>
36 #include <cppuhelper/compbase4.hxx>
37 #include "propertyids.hxx"
38 #include "connectivity/CommonTools.hxx"
39 #include "connectivity/dbtoolsdllapi.hxx"
40 #include "resource/sharedresources.hxx"
41 
42 namespace connectivity
43 {
44 	typedef ::cppu::WeakComponentImplHelper4<   ::com::sun::star::sdbc::XConnection,
45 												::com::sun::star::sdbc::XWarningsSupplier,
46                                                 ::com::sun::star::lang::XServiceInfo,
47 												::com::sun::star::lang::XUnoTunnel
48 											> OMetaConnection_BASE;
49 
50     typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >  TConditions;
51 
52 	class OOO_DLLPUBLIC_DBTOOLS OMetaConnection : public OMetaConnection_BASE
53 	{
54 	protected:
55 		::osl::Mutex		            m_aMutex;
56         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
57                                         m_aConnectionInfo;
58         connectivity::OWeakRefArray		m_aStatements;	//	vector containing a list
59 														//  of all the Statement objects
60 														//  for this Connection
61 		::rtl::OUString		            m_sURL;
62 		rtl_TextEncoding	            m_nTextEncoding; // the encoding which is used for all text conversions
63         ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData >
64                                         m_xMetaData;
65         SharedResources                 m_aResources;
66 	public:
67 
68 		static ::dbtools::OPropertyMap& getPropMap();
69 
70 		OMetaConnection();
71 
72 		inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; }
73 		inline ::rtl::OUString	getURL() const	{ return m_sURL; }
74 		inline void				setURL(const ::rtl::OUString& _rsUrl) { m_sURL = _rsUrl; }
75         void                    throwGenericSQLException( sal_uInt16 _nErrorResourceId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext  );
76         const SharedResources& getResources() const { return m_aResources;}
77 
78         inline void setConnectionInfo(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; }
79         inline const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&
80             getConnectionInfo() const { return m_aConnectionInfo; }
81 
82         // OComponentHelper
83 		virtual void SAL_CALL disposing(void);
84 
85 		//XUnoTunnel
86 		virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
87 		static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
88 	};
89 }
90 #endif // CONNECTIVITY_CONNECTION_HXX
91 
92 
93