LibreOffice Module connectivity (master) 1
TConnection.cxx
Go to the documentation of this file.
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
20#include <TConnection.hxx>
22#include <comphelper/types.hxx>
24
25using namespace connectivity;
26using namespace com::sun::star::uno;
27using namespace com::sun::star::lang;
28using namespace com::sun::star::sdbc;
29using namespace com::sun::star::beans;
30using namespace ::osl;
31
32
33OMetaConnection::OMetaConnection()
35 , m_nTextEncoding(RTL_TEXTENCODING_MS_1252)
36{
37}
38
40{
41 ::osl::MutexGuard aGuard(m_aMutex);
43 for (auto const& statement : m_aStatements)
44 {
45 try
46 {
47 Reference< XInterface > xStatement( statement.get() );
48 ::comphelper::disposeComponent( xStatement );
49 }
50 catch (const DisposedException&)
51 {
52 }
53 }
54 m_aStatements.clear();
55}
56//XUnoTunnel
57sal_Int64 SAL_CALL OMetaConnection::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
58{
59 return comphelper::getSomethingImpl(rId, this);
60}
61
63{
64 static const comphelper::UnoIdInit implId;
65 return implId.getSeq();
66}
67
69{
70 static ::dbtools::OPropertyMap s_aPropertyNameMap;
71 return s_aPropertyNameMap;
72}
73
75{
76 OUString sErrorMessage;
77 if (pErrorResourceId)
78 sErrorMessage = m_aResources.getResourceString(pErrorResourceId);
80 if ( !xContext.is() )
81 xContext = *this;
82 ::dbtools::throwGenericSQLException( sErrorMessage, xContext);
83}
84
85/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const css::uno::Sequence< sal_Int8 > & getSeq() const
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: TConnection.cxx:62
connectivity::OWeakRefArray m_aStatements
Definition: TConnection.hxx:47
::dbtools::OPropertyMap & getPropMap()
Definition: TConnection.cxx:68
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: TConnection.cxx:57
css::uno::WeakReference< css::sdbc::XDatabaseMetaData > m_xMetaData
Definition: TConnection.hxx:53
void throwGenericSQLException(TranslateId pErrorResourceId, const css::uno::Reference< css::uno::XInterface > &_xContext)
Definition: TConnection.cxx:74
virtual void SAL_CALL disposing() override
Definition: TConnection.cxx:39
OUString getResourceString(TranslateId pResId) const
loads a string from the shared resource file
std::mutex m_aMutex
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
::cppu::WeakComponentImplHelper< css::sdbc::XConnection, css::sdbc::XWarningsSupplier, css::lang::XServiceInfo, css::lang::XUnoTunnel > OMetaConnection_BASE
Definition: TConnection.hxx:39
void throwGenericSQLException(const OUString &_rMsg, const css::uno::Reference< css::uno::XInterface > &_rxSource)
throw a generic SQLException, i.e.
Reference< XComponentContext > _xContext