1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbaccess.hxx"
26 #ifndef DBA_CORE_SHARED_CONNECTION_HXX
27 #include "SharedConnection.hxx"
28 #endif
29 #ifndef _TOOLS_DEBUG_HXX
30 #include <tools/debug.hxx>
31 #endif
32 
33 
34 namespace dbaccess
35 {
36 	using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::lang;
38 using namespace ::com::sun::star::sdbc;
39 using namespace ::com::sun::star::container;
40 //	using namespace ::com::sun::star::reflection;
41 using namespace connectivity;
42 
DBG_NAME(OSharedConnection)43 DBG_NAME(OSharedConnection)
44 OSharedConnection::OSharedConnection(Reference< XAggregation >& _rxProxyConnection)
45 			: OSharedConnection_BASE(m_aMutex)
46 {
47 	DBG_CTOR(OSharedConnection,NULL);
48 	setDelegation(_rxProxyConnection,m_refCount);
49 }
50 // -----------------------------------------------------------------------------
~OSharedConnection()51 OSharedConnection::~OSharedConnection()
52 {
53 	DBG_DTOR(OSharedConnection,NULL);
54 }
55 // -----------------------------------------------------------------------------
disposing(void)56 void SAL_CALL OSharedConnection::disposing(void)
57 {
58 	OSharedConnection_BASE::disposing();
59 	OConnectionWrapper::disposing();
60 }
61 // -----------------------------------------------------------------------------
createStatement()62 Reference< XStatement > SAL_CALL OSharedConnection::createStatement(  ) throw(SQLException, RuntimeException)
63 {
64 	::osl::MutexGuard aGuard( m_aMutex );
65 	checkDisposed(rBHelper.bDisposed);
66 
67 
68 	return m_xConnection->createStatement();
69 }
70 // --------------------------------------------------------------------------------
prepareStatement(const::rtl::OUString & sql)71 Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
72 {
73 	::osl::MutexGuard aGuard( m_aMutex );
74 	checkDisposed(rBHelper.bDisposed);
75 
76 
77 	return m_xConnection->prepareStatement(sql);
78 }
79 // --------------------------------------------------------------------------------
prepareCall(const::rtl::OUString & sql)80 Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
81 {
82 	::osl::MutexGuard aGuard( m_aMutex );
83 	checkDisposed(rBHelper.bDisposed);
84 
85 
86 	return m_xConnection->prepareCall(sql);
87 }
88 // --------------------------------------------------------------------------------
nativeSQL(const::rtl::OUString & sql)89 ::rtl::OUString SAL_CALL OSharedConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
90 {
91 	::osl::MutexGuard aGuard( m_aMutex );
92 	checkDisposed(rBHelper.bDisposed);
93 
94 
95 	return m_xConnection->nativeSQL(sql);
96 }
97 // --------------------------------------------------------------------------------
getAutoCommit()98 sal_Bool SAL_CALL OSharedConnection::getAutoCommit(  ) throw(SQLException, RuntimeException)
99 {
100 	::osl::MutexGuard aGuard( m_aMutex );
101 	checkDisposed(rBHelper.bDisposed);
102 
103 
104 	return m_xConnection->getAutoCommit();
105 }
106 // --------------------------------------------------------------------------------
commit()107 void SAL_CALL OSharedConnection::commit(  ) throw(SQLException, RuntimeException)
108 {
109 	::osl::MutexGuard aGuard( m_aMutex );
110 	checkDisposed(rBHelper.bDisposed);
111 
112 
113 	m_xConnection->commit();
114 }
115 // --------------------------------------------------------------------------------
rollback()116 void SAL_CALL OSharedConnection::rollback(  ) throw(SQLException, RuntimeException)
117 {
118 	::osl::MutexGuard aGuard( m_aMutex );
119 	checkDisposed(rBHelper.bDisposed);
120 
121 
122 	m_xConnection->rollback();
123 }
124 // --------------------------------------------------------------------------------
isClosed()125 sal_Bool SAL_CALL OSharedConnection::isClosed(  ) throw(SQLException, RuntimeException)
126 {
127 	::osl::MutexGuard aGuard( m_aMutex );
128     if ( !m_xConnection.is() )
129         return sal_True;
130 
131 	return m_xConnection->isClosed();
132 }
133 // --------------------------------------------------------------------------------
getMetaData()134 Reference< XDatabaseMetaData > SAL_CALL OSharedConnection::getMetaData(  ) throw(SQLException, RuntimeException)
135 {
136 	::osl::MutexGuard aGuard( m_aMutex );
137 	checkDisposed(rBHelper.bDisposed);
138 
139 
140 	return m_xConnection->getMetaData();
141 }
142 // --------------------------------------------------------------------------------
isReadOnly()143 sal_Bool SAL_CALL OSharedConnection::isReadOnly(  ) throw(SQLException, RuntimeException)
144 {
145 	::osl::MutexGuard aGuard( m_aMutex );
146 	checkDisposed(rBHelper.bDisposed);
147 
148 
149 	return m_xConnection->isReadOnly();
150 }
151 // --------------------------------------------------------------------------------
getCatalog()152 ::rtl::OUString SAL_CALL OSharedConnection::getCatalog(  ) throw(SQLException, RuntimeException)
153 {
154 	::osl::MutexGuard aGuard( m_aMutex );
155 	checkDisposed(rBHelper.bDisposed);
156 
157 
158 	return m_xConnection->getCatalog();
159 }
160 // --------------------------------------------------------------------------------
getTransactionIsolation()161 sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation(  ) throw(SQLException, RuntimeException)
162 {
163 	::osl::MutexGuard aGuard( m_aMutex );
164 	checkDisposed(rBHelper.bDisposed);
165 
166 
167 	return m_xConnection->getTransactionIsolation();
168 }
169 // --------------------------------------------------------------------------------
getTypeMap()170 Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OSharedConnection::getTypeMap(  ) throw(SQLException, RuntimeException)
171 {
172 	::osl::MutexGuard aGuard( m_aMutex );
173 	checkDisposed(rBHelper.bDisposed);
174 
175 
176 	return m_xConnection->getTypeMap();
177 }
178 // -----------------------------------------------------------------------------
179 
180 //........................................................................
181 }	// namespace dbaccess
182 //........................................................................
183 
184 
185