bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / cpool / ZConnectionWrapper.cxx
blob46ed4bfb32c32b934ecab8b0743d17fc005867a3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "ZConnectionWrapper.hxx"
21 #include <com/sun/star/sdbc/ColumnValue.hpp>
22 #include <com/sun/star/sdbc/XRow.hpp>
23 #include <com/sun/star/lang/DisposedException.hpp>
24 #include <cppuhelper/typeprovider.hxx>
26 using namespace connectivity;
28 using namespace com::sun::star::uno;
29 using namespace com::sun::star::lang;
30 using namespace com::sun::star::beans;
31 using namespace com::sun::star::sdbc;
33 OConnectionWeakWrapper::OConnectionWeakWrapper(Reference< XAggregation >& _xConnection)
34 : OConnectionWeakWrapper_BASE(m_aMutex)
36 setDelegation(_xConnection,m_refCount);
37 OSL_ENSURE(m_xConnection.is(),"OConnectionWeakWrapper: Connection must be valid!");
40 OConnectionWeakWrapper::~OConnectionWeakWrapper()
42 if ( !OConnectionWeakWrapper_BASE::rBHelper.bDisposed )
44 osl_atomic_increment( &m_refCount );
45 dispose();
48 // XServiceInfo
50 IMPLEMENT_SERVICE_INFO(OConnectionWeakWrapper, "com.sun.star.sdbc.drivers.OConnectionWeakWrapper", "com.sun.star.sdbc.Connection")
53 Reference< XStatement > SAL_CALL OConnectionWeakWrapper::createStatement( )
55 ::osl::MutexGuard aGuard( m_aMutex );
56 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
59 return m_xConnection->createStatement();
62 Reference< XPreparedStatement > SAL_CALL OConnectionWeakWrapper::prepareStatement( const OUString& sql )
64 ::osl::MutexGuard aGuard( m_aMutex );
65 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
68 return m_xConnection->prepareStatement(sql);
71 Reference< XPreparedStatement > SAL_CALL OConnectionWeakWrapper::prepareCall( const OUString& sql )
73 ::osl::MutexGuard aGuard( m_aMutex );
74 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
77 return m_xConnection->prepareCall(sql);
80 OUString SAL_CALL OConnectionWeakWrapper::nativeSQL( const OUString& sql )
82 ::osl::MutexGuard aGuard( m_aMutex );
83 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
86 return m_xConnection->nativeSQL(sql);
89 void SAL_CALL OConnectionWeakWrapper::setAutoCommit( sal_Bool autoCommit )
91 ::osl::MutexGuard aGuard( m_aMutex );
92 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
94 m_xConnection->setAutoCommit(autoCommit);
97 sal_Bool SAL_CALL OConnectionWeakWrapper::getAutoCommit( )
99 ::osl::MutexGuard aGuard( m_aMutex );
100 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
103 return m_xConnection->getAutoCommit();
106 void SAL_CALL OConnectionWeakWrapper::commit( )
108 ::osl::MutexGuard aGuard( m_aMutex );
109 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
112 m_xConnection->commit();
115 void SAL_CALL OConnectionWeakWrapper::rollback( )
117 ::osl::MutexGuard aGuard( m_aMutex );
118 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
121 m_xConnection->rollback();
124 sal_Bool SAL_CALL OConnectionWeakWrapper::isClosed( )
126 ::osl::MutexGuard aGuard( m_aMutex );
128 return m_xConnection->isClosed();
131 Reference< XDatabaseMetaData > SAL_CALL OConnectionWeakWrapper::getMetaData( )
133 ::osl::MutexGuard aGuard( m_aMutex );
134 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
137 return m_xConnection->getMetaData();
140 void SAL_CALL OConnectionWeakWrapper::setReadOnly( sal_Bool readOnly )
142 ::osl::MutexGuard aGuard( m_aMutex );
143 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
146 m_xConnection->setReadOnly(readOnly);
149 sal_Bool SAL_CALL OConnectionWeakWrapper::isReadOnly( )
151 ::osl::MutexGuard aGuard( m_aMutex );
152 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
155 return m_xConnection->isReadOnly();
158 void SAL_CALL OConnectionWeakWrapper::setCatalog( const OUString& catalog )
160 ::osl::MutexGuard aGuard( m_aMutex );
161 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
164 m_xConnection->setCatalog(catalog);
167 OUString SAL_CALL OConnectionWeakWrapper::getCatalog( )
169 ::osl::MutexGuard aGuard( m_aMutex );
170 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
173 return m_xConnection->getCatalog();
176 void SAL_CALL OConnectionWeakWrapper::setTransactionIsolation( sal_Int32 level )
178 ::osl::MutexGuard aGuard( m_aMutex );
179 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
182 m_xConnection->setTransactionIsolation(level);
185 sal_Int32 SAL_CALL OConnectionWeakWrapper::getTransactionIsolation( )
187 ::osl::MutexGuard aGuard( m_aMutex );
188 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
191 return m_xConnection->getTransactionIsolation();
194 Reference< css::container::XNameAccess > SAL_CALL OConnectionWeakWrapper::getTypeMap( )
196 ::osl::MutexGuard aGuard( m_aMutex );
197 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
200 return m_xConnection->getTypeMap();
203 void SAL_CALL OConnectionWeakWrapper::setTypeMap( const Reference< css::container::XNameAccess >& typeMap )
205 ::osl::MutexGuard aGuard( m_aMutex );
206 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
209 m_xConnection->setTypeMap(typeMap);
212 // XCloseable
213 void SAL_CALL OConnectionWeakWrapper::close( )
216 ::osl::MutexGuard aGuard( m_aMutex );
217 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
220 dispose();
223 void OConnectionWeakWrapper::disposing()
225 ::osl::MutexGuard aGuard(m_aMutex);
227 OConnectionWeakWrapper_BASE::disposing();
228 OConnectionWrapper::disposing();
231 // css::lang::XUnoTunnel
232 IMPLEMENT_FORWARD_REFCOUNT( OConnectionWeakWrapper, OConnectionWeakWrapper_BASE )
234 css::uno::Any SAL_CALL OConnectionWeakWrapper::queryInterface( const css::uno::Type& _rType )
236 css::uno::Any aReturn = OConnectionWeakWrapper_BASE::queryInterface( _rType );
237 if ( !aReturn.hasValue() )
238 aReturn = OConnectionWrapper::queryInterface( _rType );
239 return aReturn;
242 IMPLEMENT_FORWARD_XTYPEPROVIDER2(OConnectionWeakWrapper,OConnectionWeakWrapper_BASE,OConnectionWrapper)
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */