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