Line data Source code
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 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX
20 : #define INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX
21 :
22 : #include <rtl/textenc.h>
23 : #include <com/sun/star/lang/DisposedException.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/lang/XUnoTunnel.hpp>
26 : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
27 : #include <com/sun/star/sdbc/XConnection.hpp>
28 : #include <cppuhelper/compbase4.hxx>
29 : #include "propertyids.hxx"
30 : #include <connectivity/CommonTools.hxx>
31 : #include <connectivity/dbtoolsdllapi.hxx>
32 : #include "resource/sharedresources.hxx"
33 :
34 : namespace connectivity
35 : {
36 : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XConnection,
37 : ::com::sun::star::sdbc::XWarningsSupplier,
38 : ::com::sun::star::lang::XServiceInfo,
39 : ::com::sun::star::lang::XUnoTunnel
40 : > OMetaConnection_BASE;
41 :
42 : typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > TConditions;
43 :
44 49 : class OOO_DLLPUBLIC_DBTOOLS OMetaConnection : public OMetaConnection_BASE
45 : {
46 : protected:
47 : ::osl::Mutex m_aMutex;
48 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
49 : m_aConnectionInfo;
50 : connectivity::OWeakRefArray m_aStatements; // vector containing a list
51 : // of all the Statement objects
52 : // for this Connection
53 : OUString m_sURL;
54 : rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions
55 : ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData >
56 : m_xMetaData;
57 : SharedResources m_aResources;
58 : public:
59 :
60 : static ::dbtools::OPropertyMap& getPropMap();
61 :
62 : OMetaConnection();
63 :
64 44 : inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; }
65 388 : inline OUString getURL() const { return m_sURL; }
66 41 : inline void setURL(const OUString& _rsUrl) { m_sURL = _rsUrl; }
67 : void throwGenericSQLException( sal_uInt16 _nErrorResourceId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext );
68 0 : const SharedResources& getResources() const { return m_aResources;}
69 :
70 0 : inline void setConnectionInfo(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; }
71 : inline const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&
72 41 : getConnectionInfo() const { return m_aConnectionInfo; }
73 :
74 : // OComponentHelper
75 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
76 :
77 : //XUnoTunnel
78 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
80 : };
81 : }
82 : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX
83 :
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|