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