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