tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / connectivity / source / cpool / ZConnectionWrapper.cxx
blob685f70bcdc52db991af7920811510c7a93513a63
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"
22 using namespace connectivity;
24 using namespace com::sun::star::uno;
25 using namespace com::sun::star::lang;
26 using namespace com::sun::star::sdbc;
28 OConnectionWeakWrapper::OConnectionWeakWrapper(Reference< XAggregation >& _xConnection)
30 setDelegation(_xConnection);
31 OSL_ENSURE(m_xConnection.is(),"OConnectionWeakWrapper: Connection must be valid!");
34 OConnectionWeakWrapper::~OConnectionWeakWrapper()
36 if ( !OConnectionWeakWrapper_BASE::rBHelper.bDisposed )
38 osl_atomic_increment( &m_refCount );
39 dispose();
42 // XServiceInfo
44 IMPLEMENT_SERVICE_INFO(OConnectionWeakWrapper, u"com.sun.star.sdbc.drivers.OConnectionWeakWrapper"_ustr, u"com.sun.star.sdbc.Connection"_ustr)
47 Reference< XStatement > SAL_CALL OConnectionWeakWrapper::createStatement( )
49 ::osl::MutexGuard aGuard( m_aMutex );
50 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
53 return m_xConnection->createStatement();
56 Reference< XPreparedStatement > SAL_CALL OConnectionWeakWrapper::prepareStatement( const OUString& sql )
58 ::osl::MutexGuard aGuard( m_aMutex );
59 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
62 return m_xConnection->prepareStatement(sql);
65 Reference< XPreparedStatement > SAL_CALL OConnectionWeakWrapper::prepareCall( const OUString& sql )
67 ::osl::MutexGuard aGuard( m_aMutex );
68 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
71 return m_xConnection->prepareCall(sql);
74 OUString SAL_CALL OConnectionWeakWrapper::nativeSQL( const OUString& sql )
76 ::osl::MutexGuard aGuard( m_aMutex );
77 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
80 return m_xConnection->nativeSQL(sql);
83 void SAL_CALL OConnectionWeakWrapper::setAutoCommit( sal_Bool autoCommit )
85 ::osl::MutexGuard aGuard( m_aMutex );
86 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
88 m_xConnection->setAutoCommit(autoCommit);
91 sal_Bool SAL_CALL OConnectionWeakWrapper::getAutoCommit( )
93 ::osl::MutexGuard aGuard( m_aMutex );
94 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
97 return m_xConnection->getAutoCommit();
100 void SAL_CALL OConnectionWeakWrapper::commit( )
102 ::osl::MutexGuard aGuard( m_aMutex );
103 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
106 m_xConnection->commit();
109 void SAL_CALL OConnectionWeakWrapper::rollback( )
111 ::osl::MutexGuard aGuard( m_aMutex );
112 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
115 m_xConnection->rollback();
118 sal_Bool SAL_CALL OConnectionWeakWrapper::isClosed( )
120 ::osl::MutexGuard aGuard( m_aMutex );
122 return m_xConnection->isClosed();
125 Reference< XDatabaseMetaData > SAL_CALL OConnectionWeakWrapper::getMetaData( )
127 ::osl::MutexGuard aGuard( m_aMutex );
128 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
131 return m_xConnection->getMetaData();
134 void SAL_CALL OConnectionWeakWrapper::setReadOnly( sal_Bool readOnly )
136 ::osl::MutexGuard aGuard( m_aMutex );
137 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
140 m_xConnection->setReadOnly(readOnly);
143 sal_Bool SAL_CALL OConnectionWeakWrapper::isReadOnly( )
145 ::osl::MutexGuard aGuard( m_aMutex );
146 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
149 return m_xConnection->isReadOnly();
152 void SAL_CALL OConnectionWeakWrapper::setCatalog( const OUString& catalog )
154 ::osl::MutexGuard aGuard( m_aMutex );
155 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
158 m_xConnection->setCatalog(catalog);
161 OUString SAL_CALL OConnectionWeakWrapper::getCatalog( )
163 ::osl::MutexGuard aGuard( m_aMutex );
164 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
167 return m_xConnection->getCatalog();
170 void SAL_CALL OConnectionWeakWrapper::setTransactionIsolation( sal_Int32 level )
172 ::osl::MutexGuard aGuard( m_aMutex );
173 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
176 m_xConnection->setTransactionIsolation(level);
179 sal_Int32 SAL_CALL OConnectionWeakWrapper::getTransactionIsolation( )
181 ::osl::MutexGuard aGuard( m_aMutex );
182 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
185 return m_xConnection->getTransactionIsolation();
188 Reference< css::container::XNameAccess > SAL_CALL OConnectionWeakWrapper::getTypeMap( )
190 ::osl::MutexGuard aGuard( m_aMutex );
191 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
194 return m_xConnection->getTypeMap();
197 void SAL_CALL OConnectionWeakWrapper::setTypeMap( const Reference< css::container::XNameAccess >& typeMap )
199 ::osl::MutexGuard aGuard( m_aMutex );
200 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
203 m_xConnection->setTypeMap(typeMap);
206 // XCloseable
207 void SAL_CALL OConnectionWeakWrapper::close( )
210 ::osl::MutexGuard aGuard( m_aMutex );
211 checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
214 dispose();
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */