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