1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #pragma once 20 21 #include <rtl/textenc.h> 22 #include <com/sun/star/beans/PropertyValue.hpp> 23 #include <com/sun/star/lang/XServiceInfo.hpp> 24 #include <com/sun/star/lang/XUnoTunnel.hpp> 25 #include <com/sun/star/sdbc/XWarningsSupplier.hpp> 26 #include <com/sun/star/sdbc/XConnection.hpp> 27 #include <cppuhelper/compbase.hxx> 28 #include "propertyids.hxx" 29 #include <connectivity/CommonTools.hxx> 30 #include <connectivity/dbtoolsdllapi.hxx> 31 #include "resource/sharedresources.hxx" 32 33 namespace connectivity 34 { 35 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XConnection, 36 css::sdbc::XWarningsSupplier, 37 css::lang::XServiceInfo, 38 css::lang::XUnoTunnel 39 > OMetaConnection_BASE; 40 41 class OOO_DLLPUBLIC_DBTOOLS OMetaConnection : public OMetaConnection_BASE 42 { 43 protected: 44 ::osl::Mutex m_aMutex; 45 css::uno::Sequence< css::beans::PropertyValue > 46 m_aConnectionInfo; 47 connectivity::OWeakRefArray m_aStatements; // vector containing a list 48 // of all the Statement objects 49 // for this Connection 50 OUString m_sURL; 51 rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions 52 css::uno::WeakReference< css::sdbc::XDatabaseMetaData > 53 m_xMetaData; 54 SharedResources m_aResources; 55 public: 56 57 static ::dbtools::OPropertyMap& getPropMap(); 58 59 OMetaConnection(); 60 getTextEncoding() const61 rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } getURL() const62 const OUString& getURL() const { return m_sURL; } setURL(const OUString & _rsUrl)63 void setURL(const OUString& _rsUrl) { m_sURL = _rsUrl; } 64 void throwGenericSQLException(const char* pErrorResourceId, const css::uno::Reference< css::uno::XInterface>& _xContext); getResources() const65 const SharedResources& getResources() const { return m_aResources;} 66 setConnectionInfo(const css::uno::Sequence<css::beans::PropertyValue> & _aInfo)67 void setConnectionInfo(const css::uno::Sequence< css::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; } 68 const css::uno::Sequence< css::beans::PropertyValue >& getConnectionInfo() const69 getConnectionInfo() const { return m_aConnectionInfo; } 70 71 // OComponentHelper 72 virtual void SAL_CALL disposing() override; 73 74 //XUnoTunnel 75 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; 76 static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); 77 }; 78 } 79 80 81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 82