1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9b5730f6SAndrew Rist  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19*9b5730f6SAndrew Rist  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
24cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
25cdf0e10cSrcweir #include <connectivity/paramwrapper.hxx>
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /** === begin UNO includes === **/
28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
29cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/WrappedTargetException.hpp>
31cdf0e10cSrcweir #include <com/sun/star/sdb/XParametersSupplier.hpp>
32cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
33cdf0e10cSrcweir /** === end UNO includes === **/
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <tools/diagnose_ex.h>
36cdf0e10cSrcweir #include <comphelper/enumhelper.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #define PROPERTY_ID_VALUE   1000
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //........................................................................
41cdf0e10cSrcweir namespace dbtools
42cdf0e10cSrcweir {
43cdf0e10cSrcweir namespace param
44cdf0e10cSrcweir {
45cdf0e10cSrcweir //........................................................................
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     /** === begin UNO using === **/
48cdf0e10cSrcweir     using ::com::sun::star::uno::Reference;
49cdf0e10cSrcweir     using ::com::sun::star::beans::XPropertySet;
50cdf0e10cSrcweir     using ::com::sun::star::sdbc::XParameters;
51cdf0e10cSrcweir     using ::com::sun::star::uno::Sequence;
52cdf0e10cSrcweir     using ::com::sun::star::uno::Type;
53cdf0e10cSrcweir     using ::com::sun::star::uno::RuntimeException;
54cdf0e10cSrcweir     using ::com::sun::star::uno::XWeak;
55cdf0e10cSrcweir     using ::com::sun::star::beans::XPropertySet;
56cdf0e10cSrcweir     using ::com::sun::star::beans::XFastPropertySet;
57cdf0e10cSrcweir     using ::com::sun::star::beans::XMultiPropertySet;
58cdf0e10cSrcweir     using ::com::sun::star::beans::XPropertySetInfo;
59cdf0e10cSrcweir     using ::com::sun::star::beans::Property;
60cdf0e10cSrcweir     using ::com::sun::star::uno::Exception;
61cdf0e10cSrcweir     using ::com::sun::star::uno::UNO_QUERY_THROW;
62cdf0e10cSrcweir     using ::com::sun::star::uno::Any;
63cdf0e10cSrcweir     using ::com::sun::star::lang::IllegalArgumentException;
64cdf0e10cSrcweir     using ::com::sun::star::sdbc::SQLException;
65cdf0e10cSrcweir     using ::com::sun::star::lang::WrappedTargetException;
66cdf0e10cSrcweir     using ::com::sun::star::lang::IndexOutOfBoundsException;
67cdf0e10cSrcweir     using ::com::sun::star::container::XEnumeration;
68cdf0e10cSrcweir     using ::com::sun::star::sdb::XSingleSelectQueryAnalyzer;
69cdf0e10cSrcweir     using ::com::sun::star::sdb::XParametersSupplier;
70cdf0e10cSrcweir     using ::com::sun::star::lang::DisposedException;
71cdf0e10cSrcweir     /** === end UNO using === **/
72cdf0e10cSrcweir     namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
73cdf0e10cSrcweir     namespace DataType = ::com::sun::star::sdbc::DataType;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     //====================================================================
76cdf0e10cSrcweir     //= ParameterWrapper
77cdf0e10cSrcweir     //====================================================================
78cdf0e10cSrcweir     //--------------------------------------------------------------------
ParameterWrapper(const Reference<XPropertySet> & _rxColumn)79cdf0e10cSrcweir     ParameterWrapper::ParameterWrapper( const Reference< XPropertySet >& _rxColumn )
80cdf0e10cSrcweir         :PropertyBase( m_aBHelper )
81cdf0e10cSrcweir         ,m_xDelegator( _rxColumn )
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir         if ( m_xDelegator.is() )
84cdf0e10cSrcweir             m_xDelegatorPSI = m_xDelegator->getPropertySetInfo();
85cdf0e10cSrcweir         if ( !m_xDelegatorPSI.is() )
86cdf0e10cSrcweir             throw RuntimeException();
87cdf0e10cSrcweir     }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     //--------------------------------------------------------------------
ParameterWrapper(const Reference<XPropertySet> & _rxColumn,const Reference<XParameters> & _rxAllParameters,const::std::vector<sal_Int32> & _rIndexes)90cdf0e10cSrcweir     ParameterWrapper::ParameterWrapper( const Reference< XPropertySet >& _rxColumn,
91cdf0e10cSrcweir             const Reference< XParameters >& _rxAllParameters, const ::std::vector< sal_Int32 >& _rIndexes )
92cdf0e10cSrcweir         :PropertyBase( m_aBHelper )
93cdf0e10cSrcweir         ,m_aIndexes( _rIndexes )
94cdf0e10cSrcweir         ,m_xDelegator( _rxColumn )
95cdf0e10cSrcweir         ,m_xValueDestination( _rxAllParameters )
96cdf0e10cSrcweir     {
97cdf0e10cSrcweir         if ( m_xDelegator.is() )
98cdf0e10cSrcweir             m_xDelegatorPSI = m_xDelegator->getPropertySetInfo();
99cdf0e10cSrcweir         if ( !m_xDelegatorPSI.is() )
100cdf0e10cSrcweir             throw RuntimeException();
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         OSL_ENSURE( !m_aIndexes.empty(), "ParameterWrapper::ParameterWrapper: sure about the indexes?" );
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     //--------------------------------------------------------------------
~ParameterWrapper()106cdf0e10cSrcweir     ParameterWrapper::~ParameterWrapper()
107cdf0e10cSrcweir     {
108cdf0e10cSrcweir     }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     //--------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(ParameterWrapper,UnoBase,PropertyBase)111cdf0e10cSrcweir     IMPLEMENT_FORWARD_XINTERFACE2( ParameterWrapper, UnoBase, PropertyBase )
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     //--------------------------------------------------------------------
114cdf0e10cSrcweir     Sequence< Type > SAL_CALL ParameterWrapper::getTypes(   ) throw(RuntimeException)
115cdf0e10cSrcweir     {
116cdf0e10cSrcweir         Sequence< Type > aTypes( 4 );
117cdf0e10cSrcweir         aTypes[ 1 ] = ::getCppuType( static_cast< Reference< XWeak >*             >( NULL ) );
118cdf0e10cSrcweir         aTypes[ 1 ] = ::getCppuType( static_cast< Reference< XPropertySet >*      >( NULL ) );
119cdf0e10cSrcweir         aTypes[ 2 ] = ::getCppuType( static_cast< Reference< XFastPropertySet >*  >( NULL ) );
120cdf0e10cSrcweir         aTypes[ 3 ] = ::getCppuType( static_cast< Reference< XMultiPropertySet >* >( NULL ) );
121cdf0e10cSrcweir         return aTypes;
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     //--------------------------------------------------------------------
IMPLEMENT_GET_IMPLEMENTATION_ID(ParameterWrapper)125cdf0e10cSrcweir     IMPLEMENT_GET_IMPLEMENTATION_ID( ParameterWrapper )
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     //--------------------------------------------------------------------
128cdf0e10cSrcweir     ::rtl::OUString ParameterWrapper::impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const
129cdf0e10cSrcweir     {
130cdf0e10cSrcweir         Reference< XPropertySetInfo >  xInfo = const_cast<ParameterWrapper*>( this )->getPropertySetInfo();
131cdf0e10cSrcweir         Sequence< Property > aProperties = xInfo->getProperties();
132cdf0e10cSrcweir         const Property* pProperties = aProperties.getConstArray();
133cdf0e10cSrcweir         for ( sal_Int32 i = 0; i < aProperties.getLength(); ++i, ++pProperties )
134cdf0e10cSrcweir         {
135cdf0e10cSrcweir             if ( pProperties->Handle == _nHandle )
136cdf0e10cSrcweir                 return pProperties->Name;
137cdf0e10cSrcweir         }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         OSL_ENSURE( sal_False, "ParameterWrapper::impl_getPseudoAggregatePropertyName: invalid argument!" );
140cdf0e10cSrcweir         return ::rtl::OUString();
141cdf0e10cSrcweir     }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     //--------------------------------------------------------------------
getPropertySetInfo()144cdf0e10cSrcweir     Reference< XPropertySetInfo > ParameterWrapper::getPropertySetInfo() throw( RuntimeException )
145cdf0e10cSrcweir     {
146cdf0e10cSrcweir         return createPropertySetInfo( getInfoHelper() );
147cdf0e10cSrcweir     }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     //--------------------------------------------------------------------
getInfoHelper()150cdf0e10cSrcweir     ::cppu::IPropertyArrayHelper& ParameterWrapper::getInfoHelper()
151cdf0e10cSrcweir     {
152cdf0e10cSrcweir         if ( !m_pInfoHelper.get() )
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             Sequence< Property > aProperties;
155cdf0e10cSrcweir             try
156cdf0e10cSrcweir             {
157cdf0e10cSrcweir                 aProperties = m_xDelegatorPSI->getProperties();
158cdf0e10cSrcweir                 sal_Int32 nProperties( aProperties.getLength() );
159cdf0e10cSrcweir                 aProperties.realloc( nProperties + 1 );
160cdf0e10cSrcweir                 aProperties[ nProperties ] = Property(
161cdf0e10cSrcweir                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ) ),
162cdf0e10cSrcweir                     PROPERTY_ID_VALUE,
163cdf0e10cSrcweir                     ::cppu::UnoType< Any >::get(),
164cdf0e10cSrcweir                     PropertyAttribute::TRANSIENT | PropertyAttribute::MAYBEVOID
165cdf0e10cSrcweir                 );
166cdf0e10cSrcweir             }
167cdf0e10cSrcweir             catch( const Exception& )
168cdf0e10cSrcweir             {
169cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
170cdf0e10cSrcweir             }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir             m_pInfoHelper.reset( new ::cppu::OPropertyArrayHelper( aProperties, false ) );
173cdf0e10cSrcweir         }
174cdf0e10cSrcweir         return *m_pInfoHelper;
175cdf0e10cSrcweir     }
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     //--------------------------------------------------------------------
convertFastPropertyValue(Any & rConvertedValue,Any & rOldValue,sal_Int32 nHandle,const Any & rValue)178cdf0e10cSrcweir     sal_Bool ParameterWrapper::convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) throw( IllegalArgumentException )
179cdf0e10cSrcweir     {
180cdf0e10cSrcweir         OSL_ENSURE( PROPERTY_ID_VALUE == nHandle, "ParameterWrapper::convertFastPropertyValue: the only non-readonly prop should be our PROPERTY_VALUE!" );
181cdf0e10cSrcweir         (void)nHandle;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir         // we're lazy here ...
184cdf0e10cSrcweir         rOldValue = m_aValue.makeAny();
185cdf0e10cSrcweir         rConvertedValue = rValue;
186cdf0e10cSrcweir         return sal_True;    // assume "modified" ...
187cdf0e10cSrcweir     }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     //--------------------------------------------------------------------
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any & rValue)190cdf0e10cSrcweir     void ParameterWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw( Exception )
191cdf0e10cSrcweir     {
192cdf0e10cSrcweir         if ( nHandle == PROPERTY_ID_VALUE )
193cdf0e10cSrcweir         {
194cdf0e10cSrcweir             try
195cdf0e10cSrcweir             {
196cdf0e10cSrcweir                 // TODO : aParamType & nScale can be obtained within the constructor ....
197cdf0e10cSrcweir                 sal_Int32 nParamType = DataType::VARCHAR;
198cdf0e10cSrcweir                 OSL_VERIFY( m_xDelegator->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ) ) >>= nParamType );
199cdf0e10cSrcweir 
200cdf0e10cSrcweir                 sal_Int32 nScale = 0;
201cdf0e10cSrcweir                 if ( m_xDelegatorPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scale" ) ) ) )
202cdf0e10cSrcweir                     OSL_VERIFY( m_xDelegator->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scale" ) ) ) >>= nScale );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir                 if ( m_xValueDestination.is() )
205cdf0e10cSrcweir                 {
206cdf0e10cSrcweir                     for ( ::std::vector< sal_Int32 >::iterator aIter = m_aIndexes.begin(); aIter != m_aIndexes.end(); ++aIter )
207cdf0e10cSrcweir                     {
208cdf0e10cSrcweir                         m_xValueDestination->setObjectWithInfo( *aIter + 1, rValue, nParamType, nScale );
209cdf0e10cSrcweir                             // (the index of the parameters is one-based)
210cdf0e10cSrcweir                     }
211cdf0e10cSrcweir                 }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir                 m_aValue = rValue;
214cdf0e10cSrcweir             }
215cdf0e10cSrcweir             catch( SQLException& e )
216cdf0e10cSrcweir             {
217cdf0e10cSrcweir                 WrappedTargetException aExceptionWrapper;
218cdf0e10cSrcweir                 aExceptionWrapper.Context = e.Context;
219cdf0e10cSrcweir                 aExceptionWrapper.Message = e.Message;
220cdf0e10cSrcweir                 aExceptionWrapper.TargetException <<= e;
221cdf0e10cSrcweir                 throw WrappedTargetException( aExceptionWrapper );
222cdf0e10cSrcweir             }
223cdf0e10cSrcweir         }
224cdf0e10cSrcweir         else
225cdf0e10cSrcweir         {
226cdf0e10cSrcweir             ::rtl::OUString aName = impl_getPseudoAggregatePropertyName( nHandle );
227cdf0e10cSrcweir             m_xDelegator->setPropertyValue( aName, rValue );
228cdf0e10cSrcweir         }
229cdf0e10cSrcweir     }
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     //--------------------------------------------------------------------
getFastPropertyValue(Any & rValue,sal_Int32 nHandle) const232cdf0e10cSrcweir     void ParameterWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
233cdf0e10cSrcweir     {
234cdf0e10cSrcweir         if ( nHandle == PROPERTY_ID_VALUE )
235cdf0e10cSrcweir         {
236cdf0e10cSrcweir             rValue = m_aValue.makeAny();
237cdf0e10cSrcweir         }
238cdf0e10cSrcweir         else
239cdf0e10cSrcweir         {
240cdf0e10cSrcweir             ::rtl::OUString aName = impl_getPseudoAggregatePropertyName( nHandle );
241cdf0e10cSrcweir             rValue = m_xDelegator->getPropertyValue( aName );
242cdf0e10cSrcweir         }
243cdf0e10cSrcweir     }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     //--------------------------------------------------------------------
dispose()246cdf0e10cSrcweir     void SAL_CALL ParameterWrapper::dispose()
247cdf0e10cSrcweir     {
248cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
249cdf0e10cSrcweir 
250cdf0e10cSrcweir         m_aValue.setNull();
251cdf0e10cSrcweir         m_aIndexes.resize(0);
252cdf0e10cSrcweir         m_xDelegator.clear();
253cdf0e10cSrcweir         m_xDelegatorPSI.clear();
254cdf0e10cSrcweir         m_xValueDestination.clear();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         m_aBHelper.bDisposed = sal_True;
257cdf0e10cSrcweir     }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     //====================================================================
260cdf0e10cSrcweir     //= ParameterWrapperContainer
261cdf0e10cSrcweir     //====================================================================
262cdf0e10cSrcweir     //--------------------------------------------------------------------
ParameterWrapperContainer()263cdf0e10cSrcweir     ParameterWrapperContainer::ParameterWrapperContainer()
264cdf0e10cSrcweir         :ParameterWrapperContainer_Base( m_aMutex )
265cdf0e10cSrcweir     {
266cdf0e10cSrcweir     }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     //--------------------------------------------------------------------
ParameterWrapperContainer(const Reference<XSingleSelectQueryAnalyzer> & _rxComposer)269cdf0e10cSrcweir     ParameterWrapperContainer::ParameterWrapperContainer( const Reference< XSingleSelectQueryAnalyzer >& _rxComposer )
270cdf0e10cSrcweir         :ParameterWrapperContainer_Base( m_aMutex )
271cdf0e10cSrcweir     {
272cdf0e10cSrcweir         Reference< XParametersSupplier > xSuppParams( _rxComposer, UNO_QUERY_THROW );
273cdf0e10cSrcweir         Reference< XIndexAccess > xParameters( xSuppParams->getParameters(), UNO_QUERY_THROW );
274cdf0e10cSrcweir         sal_Int32 nParamCount( xParameters->getCount() );
275cdf0e10cSrcweir         m_aParameters.reserve( nParamCount );
276cdf0e10cSrcweir         for ( sal_Int32 i=0; i<nParamCount; ++i )
277cdf0e10cSrcweir         {
278cdf0e10cSrcweir             m_aParameters.push_back( new ParameterWrapper( Reference< XPropertySet >( xParameters->getByIndex( i ), UNO_QUERY_THROW ) ) );
279cdf0e10cSrcweir         }
280cdf0e10cSrcweir     }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     //--------------------------------------------------------------------
~ParameterWrapperContainer()283cdf0e10cSrcweir     ParameterWrapperContainer::~ParameterWrapperContainer()
284cdf0e10cSrcweir     {
285cdf0e10cSrcweir     }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir     //--------------------------------------------------------------------
getElementType()288cdf0e10cSrcweir     Type SAL_CALL ParameterWrapperContainer::getElementType() throw( RuntimeException )
289cdf0e10cSrcweir     {
290cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
291cdf0e10cSrcweir         impl_checkDisposed_throw();
292cdf0e10cSrcweir         return ::getCppuType( static_cast< Reference< XPropertySet >* >( NULL ) );
293cdf0e10cSrcweir     }
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     //--------------------------------------------------------------------
hasElements()296cdf0e10cSrcweir     sal_Bool SAL_CALL ParameterWrapperContainer::hasElements() throw( RuntimeException )
297cdf0e10cSrcweir     {
298cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
299cdf0e10cSrcweir         impl_checkDisposed_throw();
300cdf0e10cSrcweir         return !m_aParameters.empty();
301cdf0e10cSrcweir     }
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     //--------------------------------------------------------------------
getCount()304cdf0e10cSrcweir     sal_Int32 SAL_CALL ParameterWrapperContainer::getCount() throw( RuntimeException )
305cdf0e10cSrcweir     {
306cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
307cdf0e10cSrcweir         impl_checkDisposed_throw();
308cdf0e10cSrcweir         return m_aParameters.size();
309cdf0e10cSrcweir     }
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     //--------------------------------------------------------------------
getByIndex(sal_Int32 _nIndex)312cdf0e10cSrcweir     Any SAL_CALL ParameterWrapperContainer::getByIndex( sal_Int32 _nIndex ) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
313cdf0e10cSrcweir     {
314cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
315cdf0e10cSrcweir         impl_checkDisposed_throw();
316cdf0e10cSrcweir 
317cdf0e10cSrcweir         if ( ( _nIndex < 0 ) || ( _nIndex >= (sal_Int32)m_aParameters.size() ) )
318cdf0e10cSrcweir             throw IndexOutOfBoundsException();
319cdf0e10cSrcweir 
320cdf0e10cSrcweir         return makeAny( Reference< XPropertySet >( m_aParameters[ _nIndex ].get() ) );
321cdf0e10cSrcweir     }
322cdf0e10cSrcweir 
323cdf0e10cSrcweir     //--------------------------------------------------------------------
createEnumeration()324cdf0e10cSrcweir     Reference< XEnumeration > ParameterWrapperContainer::createEnumeration() throw( RuntimeException )
325cdf0e10cSrcweir     {
326cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
327cdf0e10cSrcweir         impl_checkDisposed_throw();
328cdf0e10cSrcweir 
329cdf0e10cSrcweir         return new ::comphelper::OEnumerationByIndex( static_cast< XIndexAccess* >( this ) );
330cdf0e10cSrcweir     }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir     //--------------------------------------------------------------------
impl_checkDisposed_throw()333cdf0e10cSrcweir     void ParameterWrapperContainer::impl_checkDisposed_throw()
334cdf0e10cSrcweir     {
335cdf0e10cSrcweir         if ( rBHelper.bDisposed )
336cdf0e10cSrcweir             throw DisposedException( ::rtl::OUString(), *this );
337cdf0e10cSrcweir     }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir     //--------------------------------------------------------------------
disposing()340cdf0e10cSrcweir     void SAL_CALL ParameterWrapperContainer::disposing()
341cdf0e10cSrcweir     {
342cdf0e10cSrcweir         ::osl::MutexGuard aGuard( m_aMutex );
343cdf0e10cSrcweir         impl_checkDisposed_throw();
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         for (   Parameters::const_iterator param = m_aParameters.begin();
346cdf0e10cSrcweir                 param != m_aParameters.end();
347cdf0e10cSrcweir                 ++param
348cdf0e10cSrcweir             )
349cdf0e10cSrcweir         {
350cdf0e10cSrcweir             (*param)->dispose();
351cdf0e10cSrcweir         }
352cdf0e10cSrcweir 
353cdf0e10cSrcweir         Parameters aEmpty;
354cdf0e10cSrcweir         m_aParameters.swap( aEmpty );
355cdf0e10cSrcweir     }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir //........................................................................
358cdf0e10cSrcweir } } // namespace dbtools::param
359cdf0e10cSrcweir //........................................................................
360cdf0e10cSrcweir 
361