1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "SharedConnection.hxx"
21 #include <comphelper/uno3.hxx>
25 using namespace ::com::sun::star::uno
;
26 using namespace ::com::sun::star::lang
;
27 using namespace ::com::sun::star::sdbc
;
28 using namespace ::com::sun::star::container
;
29 using namespace connectivity
;
31 OSharedConnection::OSharedConnection(Reference
<XAggregation
>& _rxProxyConnection
)
32 : OSharedConnection_BASE(m_aMutex
)
34 setDelegation(_rxProxyConnection
, m_refCount
);
37 OSharedConnection::~OSharedConnection() {}
39 void SAL_CALL
OSharedConnection::disposing()
41 OSharedConnection_BASE::disposing();
42 OConnectionWrapper::disposing();
45 Reference
<XStatement
> SAL_CALL
OSharedConnection::createStatement()
47 ::osl::MutexGuard
aGuard(m_aMutex
);
48 checkDisposed(rBHelper
.bDisposed
);
50 return m_xConnection
->createStatement();
53 Reference
<XPreparedStatement
> SAL_CALL
OSharedConnection::prepareStatement(const OUString
& sql
)
55 ::osl::MutexGuard
aGuard(m_aMutex
);
56 checkDisposed(rBHelper
.bDisposed
);
58 return m_xConnection
->prepareStatement(sql
);
61 Reference
<XPreparedStatement
> SAL_CALL
OSharedConnection::prepareCall(const OUString
& sql
)
63 ::osl::MutexGuard
aGuard(m_aMutex
);
64 checkDisposed(rBHelper
.bDisposed
);
66 return m_xConnection
->prepareCall(sql
);
69 OUString SAL_CALL
OSharedConnection::nativeSQL(const OUString
& sql
)
71 ::osl::MutexGuard
aGuard(m_aMutex
);
72 checkDisposed(rBHelper
.bDisposed
);
74 return m_xConnection
->nativeSQL(sql
);
77 sal_Bool SAL_CALL
OSharedConnection::getAutoCommit()
79 ::osl::MutexGuard
aGuard(m_aMutex
);
80 checkDisposed(rBHelper
.bDisposed
);
82 return m_xConnection
->getAutoCommit();
85 void SAL_CALL
OSharedConnection::commit()
87 ::osl::MutexGuard
aGuard(m_aMutex
);
88 checkDisposed(rBHelper
.bDisposed
);
90 m_xConnection
->commit();
93 void SAL_CALL
OSharedConnection::rollback()
95 ::osl::MutexGuard
aGuard(m_aMutex
);
96 checkDisposed(rBHelper
.bDisposed
);
98 m_xConnection
->rollback();
101 sal_Bool SAL_CALL
OSharedConnection::isClosed()
103 ::osl::MutexGuard
aGuard(m_aMutex
);
104 if (!m_xConnection
.is())
107 return m_xConnection
->isClosed();
110 Reference
<XDatabaseMetaData
> SAL_CALL
OSharedConnection::getMetaData()
112 ::osl::MutexGuard
aGuard(m_aMutex
);
113 checkDisposed(rBHelper
.bDisposed
);
115 return m_xConnection
->getMetaData();
118 sal_Bool SAL_CALL
OSharedConnection::isReadOnly()
120 ::osl::MutexGuard
aGuard(m_aMutex
);
121 checkDisposed(rBHelper
.bDisposed
);
123 return m_xConnection
->isReadOnly();
126 OUString SAL_CALL
OSharedConnection::getCatalog()
128 ::osl::MutexGuard
aGuard(m_aMutex
);
129 checkDisposed(rBHelper
.bDisposed
);
131 return m_xConnection
->getCatalog();
134 sal_Int32 SAL_CALL
OSharedConnection::getTransactionIsolation()
136 ::osl::MutexGuard
aGuard(m_aMutex
);
137 checkDisposed(rBHelper
.bDisposed
);
139 return m_xConnection
->getTransactionIsolation();
142 Reference
<css::container::XNameAccess
> SAL_CALL
OSharedConnection::getTypeMap()
144 ::osl::MutexGuard
aGuard(m_aMutex
);
145 checkDisposed(rBHelper
.bDisposed
);
147 return m_xConnection
->getTypeMap();
150 IMPLEMENT_GET_IMPLEMENTATION_ID(OSharedConnection
)
152 } // namespace dbaccess
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */