1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CONNECTIVITY_CONNECTION_HXX
24 #define CONNECTIVITY_CONNECTION_HXX
25 
26 #include <rtl/textenc.h>
27 #include <com/sun/star/lang/DisposedException.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/lang/XUnoTunnel.hpp>
30 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
31 #include <com/sun/star/sdbc/XConnection.hpp>
32 #include <cppuhelper/compbase4.hxx>
33 #include "propertyids.hxx"
34 #include "connectivity/CommonTools.hxx"
35 #include "connectivity/dbtoolsdllapi.hxx"
36 #include "resource/sharedresources.hxx"
37 
38 namespace connectivity
39 {
40 	typedef ::cppu::WeakComponentImplHelper4<   ::com::sun::star::sdbc::XConnection,
41 												::com::sun::star::sdbc::XWarningsSupplier,
42                                                 ::com::sun::star::lang::XServiceInfo,
43 												::com::sun::star::lang::XUnoTunnel
44 											> OMetaConnection_BASE;
45 
46     typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >  TConditions;
47 
48 	class OOO_DLLPUBLIC_DBTOOLS OMetaConnection : public OMetaConnection_BASE
49 	{
50 	protected:
51 		::osl::Mutex		            m_aMutex;
52         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
53                                         m_aConnectionInfo;
54         connectivity::OWeakRefArray		m_aStatements;	//	vector containing a list
55 														//  of all the Statement objects
56 														//  for this Connection
57 		::rtl::OUString		            m_sURL;
58 		rtl_TextEncoding	            m_nTextEncoding; // the encoding which is used for all text conversions
59         ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData >
60                                         m_xMetaData;
61         SharedResources                 m_aResources;
62 	public:
63 
64 		static ::dbtools::OPropertyMap& getPropMap();
65 
66 		OMetaConnection();
67 
getTextEncoding() const68 		inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; }
getURL() const69 		inline ::rtl::OUString	getURL() const	{ return m_sURL; }
setURL(const::rtl::OUString & _rsUrl)70 		inline void				setURL(const ::rtl::OUString& _rsUrl) { m_sURL = _rsUrl; }
71         void                    throwGenericSQLException( sal_uInt16 _nErrorResourceId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext  );
getResources() const72         const SharedResources& getResources() const { return m_aResources;}
73 
setConnectionInfo(const::com::sun::star::uno::Sequence<::com::sun::star::beans::PropertyValue> & _aInfo)74         inline void setConnectionInfo(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; }
75         inline const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&
getConnectionInfo() const76             getConnectionInfo() const { return m_aConnectionInfo; }
77 
78         // OComponentHelper
79 		virtual void SAL_CALL disposing(void);
80 
81 		//XUnoTunnel
82 		virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
83 		static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
84 	};
85 }
86 #endif // CONNECTIVITY_CONNECTION_HXX
87 
88 
89