LibreOffice Module dbaccess (master) 1
SharedConnection.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 "SharedConnection.hxx"
21#include <comphelper/uno3.hxx>
22
23namespace dbaccess
24{
25using namespace ::com::sun::star::uno;
26using namespace ::com::sun::star::lang;
27using namespace ::com::sun::star::sdbc;
28using namespace ::com::sun::star::container;
29using namespace connectivity;
30
31OSharedConnection::OSharedConnection(Reference<XAggregation>& _rxProxyConnection)
33{
34 setDelegation(_rxProxyConnection, m_refCount);
35}
36
38
40{
41 OSharedConnection_BASE::disposing();
43}
44
45Reference<XStatement> SAL_CALL OSharedConnection::createStatement()
46{
47 ::osl::MutexGuard aGuard(m_aMutex);
48 checkDisposed(rBHelper.bDisposed);
49
50 return m_xConnection->createStatement();
51}
52
53Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareStatement(const OUString& sql)
54{
55 ::osl::MutexGuard aGuard(m_aMutex);
56 checkDisposed(rBHelper.bDisposed);
57
58 return m_xConnection->prepareStatement(sql);
59}
60
61Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareCall(const OUString& sql)
62{
63 ::osl::MutexGuard aGuard(m_aMutex);
64 checkDisposed(rBHelper.bDisposed);
65
66 return m_xConnection->prepareCall(sql);
67}
68
69OUString SAL_CALL OSharedConnection::nativeSQL(const OUString& sql)
70{
71 ::osl::MutexGuard aGuard(m_aMutex);
72 checkDisposed(rBHelper.bDisposed);
73
74 return m_xConnection->nativeSQL(sql);
75}
76
78{
79 ::osl::MutexGuard aGuard(m_aMutex);
80 checkDisposed(rBHelper.bDisposed);
81
82 return m_xConnection->getAutoCommit();
83}
84
86{
87 ::osl::MutexGuard aGuard(m_aMutex);
88 checkDisposed(rBHelper.bDisposed);
89
90 m_xConnection->commit();
91}
92
94{
95 ::osl::MutexGuard aGuard(m_aMutex);
96 checkDisposed(rBHelper.bDisposed);
97
98 m_xConnection->rollback();
99}
100
102{
103 ::osl::MutexGuard aGuard(m_aMutex);
104 if (!m_xConnection.is())
105 return true;
106
107 return m_xConnection->isClosed();
108}
109
110Reference<XDatabaseMetaData> SAL_CALL OSharedConnection::getMetaData()
111{
112 ::osl::MutexGuard aGuard(m_aMutex);
113 checkDisposed(rBHelper.bDisposed);
114
115 return m_xConnection->getMetaData();
116}
117
119{
120 ::osl::MutexGuard aGuard(m_aMutex);
121 checkDisposed(rBHelper.bDisposed);
122
123 return m_xConnection->isReadOnly();
124}
125
127{
128 ::osl::MutexGuard aGuard(m_aMutex);
129 checkDisposed(rBHelper.bDisposed);
130
131 return m_xConnection->getCatalog();
132}
133
135{
136 ::osl::MutexGuard aGuard(m_aMutex);
137 checkDisposed(rBHelper.bDisposed);
138
139 return m_xConnection->getTransactionIsolation();
140}
141
142Reference<css::container::XNameAccess> SAL_CALL OSharedConnection::getTypeMap()
143{
144 ::osl::MutexGuard aGuard(m_aMutex);
145 checkDisposed(rBHelper.bDisposed);
146
147 return m_xConnection->getTypeMap();
148}
149
151
152} // namespace dbaccess
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void setDelegation(css::uno::Reference< css::uno::XAggregation > &_rxProxyConnection, oslInterlockedCount &_rRefCount)
css::uno::Reference< css::sdbc::XConnection > m_xConnection
mutable::osl::Mutex m_aMutex
virtual OUString SAL_CALL nativeSQL(const OUString &sql) override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap() override
virtual sal_Bool SAL_CALL isReadOnly() override
virtual void SAL_CALL commit() override
virtual OUString SAL_CALL getCatalog() override
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString &sql) override
virtual void SAL_CALL disposing() override
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString &sql) override
virtual sal_Bool SAL_CALL getAutoCommit() override
virtual sal_Bool SAL_CALL isClosed() override
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() override
virtual ~OSharedConnection() override
OSharedConnection(css::uno::Reference< css::uno::XAggregation > &_rxProxyConnection)
virtual void SAL_CALL rollback() override
virtual sal_Int32 SAL_CALL getTransactionIsolation() override
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override
ULONG m_refCount
std::mutex m_aMutex
void checkDisposed(bool _bThrow)
::cppu::WeakComponentImplHelper< css::sdbc::XConnection > OSharedConnection_BASE
IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController)
unsigned char sal_Bool