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
)
33 setDelegation(_rxProxyConnection
);
36 OSharedConnection::~OSharedConnection() {}
38 Reference
<XStatement
> SAL_CALL
OSharedConnection::createStatement()
40 ::osl::MutexGuard
aGuard(m_aMutex
);
41 checkDisposed(rBHelper
.bDisposed
);
43 return m_xConnection
->createStatement();
46 Reference
<XPreparedStatement
> SAL_CALL
OSharedConnection::prepareStatement(const OUString
& sql
)
48 ::osl::MutexGuard
aGuard(m_aMutex
);
49 checkDisposed(rBHelper
.bDisposed
);
51 return m_xConnection
->prepareStatement(sql
);
54 Reference
<XPreparedStatement
> SAL_CALL
OSharedConnection::prepareCall(const OUString
& sql
)
56 ::osl::MutexGuard
aGuard(m_aMutex
);
57 checkDisposed(rBHelper
.bDisposed
);
59 return m_xConnection
->prepareCall(sql
);
62 OUString SAL_CALL
OSharedConnection::nativeSQL(const OUString
& sql
)
64 ::osl::MutexGuard
aGuard(m_aMutex
);
65 checkDisposed(rBHelper
.bDisposed
);
67 return m_xConnection
->nativeSQL(sql
);
70 sal_Bool SAL_CALL
OSharedConnection::getAutoCommit()
72 ::osl::MutexGuard
aGuard(m_aMutex
);
73 checkDisposed(rBHelper
.bDisposed
);
75 return m_xConnection
->getAutoCommit();
78 void SAL_CALL
OSharedConnection::commit()
80 ::osl::MutexGuard
aGuard(m_aMutex
);
81 checkDisposed(rBHelper
.bDisposed
);
83 m_xConnection
->commit();
86 void SAL_CALL
OSharedConnection::rollback()
88 ::osl::MutexGuard
aGuard(m_aMutex
);
89 checkDisposed(rBHelper
.bDisposed
);
91 m_xConnection
->rollback();
94 sal_Bool SAL_CALL
OSharedConnection::isClosed()
96 ::osl::MutexGuard
aGuard(m_aMutex
);
97 if (!m_xConnection
.is())
100 return m_xConnection
->isClosed();
103 Reference
<XDatabaseMetaData
> SAL_CALL
OSharedConnection::getMetaData()
105 ::osl::MutexGuard
aGuard(m_aMutex
);
106 checkDisposed(rBHelper
.bDisposed
);
108 return m_xConnection
->getMetaData();
111 sal_Bool SAL_CALL
OSharedConnection::isReadOnly()
113 ::osl::MutexGuard
aGuard(m_aMutex
);
114 checkDisposed(rBHelper
.bDisposed
);
116 return m_xConnection
->isReadOnly();
119 OUString SAL_CALL
OSharedConnection::getCatalog()
121 ::osl::MutexGuard
aGuard(m_aMutex
);
122 checkDisposed(rBHelper
.bDisposed
);
124 return m_xConnection
->getCatalog();
127 sal_Int32 SAL_CALL
OSharedConnection::getTransactionIsolation()
129 ::osl::MutexGuard
aGuard(m_aMutex
);
130 checkDisposed(rBHelper
.bDisposed
);
132 return m_xConnection
->getTransactionIsolation();
135 Reference
<css::container::XNameAccess
> SAL_CALL
OSharedConnection::getTypeMap()
137 ::osl::MutexGuard
aGuard(m_aMutex
);
138 checkDisposed(rBHelper
.bDisposed
);
140 return m_xConnection
->getTypeMap();
143 } // namespace dbaccess
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */