1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 #ifndef DBA_CORE_SHARED_CONNECTION_HXX
31 #include "SharedConnection.hxx"
32 #endif
33 #ifndef _TOOLS_DEBUG_HXX
34 #include <tools/debug.hxx>
35 #endif
36 
37 
38 namespace dbaccess
39 {
40 	using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::lang;
42 using namespace ::com::sun::star::sdbc;
43 using namespace ::com::sun::star::container;
44 //	using namespace ::com::sun::star::reflection;
45 using namespace connectivity;
46 
47 DBG_NAME(OSharedConnection)
48 OSharedConnection::OSharedConnection(Reference< XAggregation >& _rxProxyConnection)
49 			: OSharedConnection_BASE(m_aMutex)
50 {
51 	DBG_CTOR(OSharedConnection,NULL);
52 	setDelegation(_rxProxyConnection,m_refCount);
53 }
54 // -----------------------------------------------------------------------------
55 OSharedConnection::~OSharedConnection()
56 {
57 	DBG_DTOR(OSharedConnection,NULL);
58 }
59 // -----------------------------------------------------------------------------
60 void SAL_CALL OSharedConnection::disposing(void)
61 {
62 	OSharedConnection_BASE::disposing();
63 	OConnectionWrapper::disposing();
64 }
65 // -----------------------------------------------------------------------------
66 Reference< XStatement > SAL_CALL OSharedConnection::createStatement(  ) throw(SQLException, RuntimeException)
67 {
68 	::osl::MutexGuard aGuard( m_aMutex );
69 	checkDisposed(rBHelper.bDisposed);
70 
71 
72 	return m_xConnection->createStatement();
73 }
74 // --------------------------------------------------------------------------------
75 Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
76 {
77 	::osl::MutexGuard aGuard( m_aMutex );
78 	checkDisposed(rBHelper.bDisposed);
79 
80 
81 	return m_xConnection->prepareStatement(sql);
82 }
83 // --------------------------------------------------------------------------------
84 Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
85 {
86 	::osl::MutexGuard aGuard( m_aMutex );
87 	checkDisposed(rBHelper.bDisposed);
88 
89 
90 	return m_xConnection->prepareCall(sql);
91 }
92 // --------------------------------------------------------------------------------
93 ::rtl::OUString SAL_CALL OSharedConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
94 {
95 	::osl::MutexGuard aGuard( m_aMutex );
96 	checkDisposed(rBHelper.bDisposed);
97 
98 
99 	return m_xConnection->nativeSQL(sql);
100 }
101 // --------------------------------------------------------------------------------
102 sal_Bool SAL_CALL OSharedConnection::getAutoCommit(  ) throw(SQLException, RuntimeException)
103 {
104 	::osl::MutexGuard aGuard( m_aMutex );
105 	checkDisposed(rBHelper.bDisposed);
106 
107 
108 	return m_xConnection->getAutoCommit();
109 }
110 // --------------------------------------------------------------------------------
111 void SAL_CALL OSharedConnection::commit(  ) throw(SQLException, RuntimeException)
112 {
113 	::osl::MutexGuard aGuard( m_aMutex );
114 	checkDisposed(rBHelper.bDisposed);
115 
116 
117 	m_xConnection->commit();
118 }
119 // --------------------------------------------------------------------------------
120 void SAL_CALL OSharedConnection::rollback(  ) throw(SQLException, RuntimeException)
121 {
122 	::osl::MutexGuard aGuard( m_aMutex );
123 	checkDisposed(rBHelper.bDisposed);
124 
125 
126 	m_xConnection->rollback();
127 }
128 // --------------------------------------------------------------------------------
129 sal_Bool SAL_CALL OSharedConnection::isClosed(  ) throw(SQLException, RuntimeException)
130 {
131 	::osl::MutexGuard aGuard( m_aMutex );
132     if ( !m_xConnection.is() )
133         return sal_True;
134 
135 	return m_xConnection->isClosed();
136 }
137 // --------------------------------------------------------------------------------
138 Reference< XDatabaseMetaData > SAL_CALL OSharedConnection::getMetaData(  ) throw(SQLException, RuntimeException)
139 {
140 	::osl::MutexGuard aGuard( m_aMutex );
141 	checkDisposed(rBHelper.bDisposed);
142 
143 
144 	return m_xConnection->getMetaData();
145 }
146 // --------------------------------------------------------------------------------
147 sal_Bool SAL_CALL OSharedConnection::isReadOnly(  ) throw(SQLException, RuntimeException)
148 {
149 	::osl::MutexGuard aGuard( m_aMutex );
150 	checkDisposed(rBHelper.bDisposed);
151 
152 
153 	return m_xConnection->isReadOnly();
154 }
155 // --------------------------------------------------------------------------------
156 ::rtl::OUString SAL_CALL OSharedConnection::getCatalog(  ) throw(SQLException, RuntimeException)
157 {
158 	::osl::MutexGuard aGuard( m_aMutex );
159 	checkDisposed(rBHelper.bDisposed);
160 
161 
162 	return m_xConnection->getCatalog();
163 }
164 // --------------------------------------------------------------------------------
165 sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation(  ) throw(SQLException, RuntimeException)
166 {
167 	::osl::MutexGuard aGuard( m_aMutex );
168 	checkDisposed(rBHelper.bDisposed);
169 
170 
171 	return m_xConnection->getTransactionIsolation();
172 }
173 // --------------------------------------------------------------------------------
174 Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OSharedConnection::getTypeMap(  ) throw(SQLException, RuntimeException)
175 {
176 	::osl::MutexGuard aGuard( m_aMutex );
177 	checkDisposed(rBHelper.bDisposed);
178 
179 
180 	return m_xConnection->getTypeMap();
181 }
182 // -----------------------------------------------------------------------------
183 
184 //........................................................................
185 }	// namespace dbaccess
186 //........................................................................
187 
188 
189