Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "connectivity/parameters.hxx"
21 :
22 : #include <com/sun/star/form/DatabaseParameterEvent.hpp>
23 : #include <com/sun/star/sdbc/XParameters.hpp>
24 : #include <com/sun/star/container/XChild.hpp>
25 : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
26 : #include <com/sun/star/container/XEnumerationAccess.hpp>
27 : #include <com/sun/star/sdb/XParametersSupplier.hpp>
28 : #include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
29 : #include <com/sun/star/sdb/ParametersRequest.hpp>
30 :
31 : #include <connectivity/dbtools.hxx>
32 : #include "connectivity/filtermanager.hxx"
33 : #include "TConnection.hxx"
34 :
35 : #include <tools/debug.hxx>
36 : #include <tools/diagnose_ex.h>
37 :
38 : #include <comphelper/uno3.hxx>
39 : #include <comphelper/proparrhlp.hxx>
40 : #include <comphelper/broadcasthelper.hxx>
41 : #include "connectivity/ParameterCont.hxx"
42 : #include <rtl/ustrbuf.hxx>
43 :
44 :
45 : namespace dbtools
46 : {
47 :
48 :
49 : using namespace ::com::sun::star::uno;
50 : using namespace ::com::sun::star::sdb;
51 : using namespace ::com::sun::star::sdbc;
52 : using namespace ::com::sun::star::sdbcx;
53 : using namespace ::com::sun::star::lang;
54 : using namespace ::com::sun::star::beans;
55 : using namespace ::com::sun::star::task;
56 : using namespace ::com::sun::star::form;
57 : using namespace ::com::sun::star::container;
58 :
59 : using namespace ::comphelper;
60 : using namespace ::connectivity;
61 :
62 :
63 : //= ParameterManager
64 :
65 :
66 0 : ParameterManager::ParameterManager( ::osl::Mutex& _rMutex, const Reference< XComponentContext >& _rxContext )
67 : :m_rMutex ( _rMutex )
68 : ,m_aParameterListeners( _rMutex )
69 : ,m_xContext ( _rxContext )
70 : ,m_pOuterParameters ( NULL )
71 : ,m_nInnerCount ( 0 )
72 0 : ,m_bUpToDate ( false )
73 : {
74 : OSL_ENSURE( m_xContext.is(), "ParameterManager::ParameterManager: no service factory!" );
75 0 : }
76 :
77 :
78 0 : void ParameterManager::initialize( const Reference< XPropertySet >& _rxComponent, const Reference< XAggregation >& _rxComponentAggregate )
79 : {
80 : OSL_ENSURE( !m_xComponent.get().is(), "ParameterManager::initialize: already initialized!" );
81 :
82 0 : m_xComponent = _rxComponent;
83 0 : m_xAggregatedRowSet = _rxComponentAggregate;
84 0 : if ( m_xAggregatedRowSet.is() )
85 0 : m_xAggregatedRowSet->queryAggregation( ::getCppuType( &m_xInnerParamUpdate ) ) >>= m_xInnerParamUpdate;
86 : OSL_ENSURE( m_xComponent.get().is() && m_xInnerParamUpdate.is(), "ParameterManager::initialize: invalid arguments!" );
87 0 : if ( !m_xComponent.get().is() || !m_xInnerParamUpdate.is() )
88 0 : return;
89 : }
90 :
91 :
92 0 : void ParameterManager::dispose( )
93 : {
94 0 : clearAllParameterInformation();
95 :
96 0 : m_xComposer.clear();
97 0 : m_xParentComposer.clear();
98 : //m_xComponent.clear();
99 0 : m_xInnerParamUpdate.clear();
100 0 : m_xAggregatedRowSet.clear();
101 0 : }
102 :
103 :
104 0 : void ParameterManager::clearAllParameterInformation()
105 : {
106 0 : m_xInnerParamColumns.clear();
107 0 : if ( m_pOuterParameters.is() )
108 0 : m_pOuterParameters->dispose();
109 0 : m_pOuterParameters = NULL;
110 0 : m_nInnerCount = 0;
111 0 : ParameterInformation aEmptyInfo;
112 0 : m_aParameterInformation.swap( aEmptyInfo );
113 0 : m_aMasterFields.realloc( 0 );
114 0 : m_aDetailFields.realloc( 0 );
115 0 : m_sIdentifierQuoteString = OUString();
116 0 : ::std::vector< bool > aEmptyArray;
117 0 : m_aParametersVisited.swap( aEmptyArray );
118 0 : m_bUpToDate = false;
119 0 : }
120 :
121 :
122 0 : void ParameterManager::disposing( const EventObject& /*_rDisposingEvent*/ )
123 : {
124 0 : }
125 :
126 :
127 0 : void ParameterManager::setAllParametersNull() SAL_THROW( ( SQLException, RuntimeException ) )
128 : {
129 : OSL_PRECOND( isAlive(), "ParameterManager::setAllParametersNull: not initialized, or already disposed!" );
130 0 : if ( !isAlive() )
131 0 : return;
132 :
133 0 : for ( sal_Int32 i = 1; i <= m_nInnerCount; ++i )
134 0 : m_xInnerParamUpdate->setNull( i, DataType::VARCHAR );
135 : }
136 :
137 :
138 0 : bool ParameterManager::initializeComposerByComponent( const Reference< XPropertySet >& _rxComponent )
139 : {
140 : OSL_PRECOND( _rxComponent.is(), "ParameterManager::initializeComposerByComponent: invalid !" );
141 :
142 0 : m_xComposer.clear();
143 0 : m_xInnerParamColumns.clear();
144 0 : m_nInnerCount = 0;
145 :
146 : // create and fill a composer
147 : try
148 : {
149 : // get a query composer for the 's settings
150 0 : m_xComposer.reset( getCurrentSettingsComposer( _rxComponent, m_xContext ), SharedQueryComposer::TakeOwnership );
151 :
152 : // see if the composer found parameters
153 0 : Reference< XParametersSupplier > xParamSupp( m_xComposer, UNO_QUERY );
154 0 : if ( xParamSupp.is() )
155 0 : m_xInnerParamColumns = xParamSupp->getParameters();
156 :
157 0 : if ( m_xInnerParamColumns.is() )
158 0 : m_nInnerCount = m_xInnerParamColumns->getCount();
159 : }
160 0 : catch( const SQLException& )
161 : {
162 : }
163 :
164 0 : return m_xInnerParamColumns.is();
165 : }
166 :
167 :
168 0 : void ParameterManager::collectInnerParameters( bool _bSecondRun )
169 : {
170 : OSL_PRECOND( m_xInnerParamColumns.is(), "ParameterManager::collectInnerParameters: missing some internal data!" );
171 0 : if ( !m_xInnerParamColumns.is() )
172 0 : return;
173 :
174 : // strip previous index information
175 0 : if ( _bSecondRun )
176 : {
177 0 : for ( ParameterInformation::iterator aParamInfo = m_aParameterInformation.begin();
178 0 : aParamInfo != m_aParameterInformation.end();
179 : ++aParamInfo
180 : )
181 : {
182 0 : aParamInfo->second.aInnerIndexes.clear();
183 : }
184 : }
185 :
186 : // we need to map the parameter names (which is all we get from the 's
187 : // MasterFields property) to indicies, which are needed by the XParameters
188 : // interface of the row set)
189 0 : Reference<XPropertySet> xParam;
190 0 : for ( sal_Int32 i = 0; i < m_nInnerCount; ++i )
191 : {
192 : try
193 : {
194 0 : xParam.clear();
195 0 : m_xInnerParamColumns->getByIndex( i ) >>= xParam;
196 :
197 0 : OUString sName;
198 0 : xParam->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME) ) >>= sName;
199 :
200 : // only append additional parameters when they are not already in the list
201 0 : ParameterInformation::iterator aExistentPos = m_aParameterInformation.find( sName );
202 : OSL_ENSURE( !_bSecondRun || ( aExistentPos != m_aParameterInformation.end() ),
203 : "ParameterManager::collectInnerParameters: the parameter information should already exist in the second run!" );
204 :
205 0 : if ( aExistentPos == m_aParameterInformation.end() )
206 : {
207 : aExistentPos = m_aParameterInformation.insert( ParameterInformation::value_type(
208 0 : sName, xParam ) ).first;
209 : }
210 : else
211 0 : aExistentPos->second.xComposerColumn = xParam;
212 :
213 0 : aExistentPos->second.aInnerIndexes.push_back( i );
214 : }
215 0 : catch( const Exception& )
216 : {
217 : SAL_WARN( "connectivity.commontools", "ParameterManager::collectInnerParameters: caught an exception!" );
218 : }
219 0 : }
220 : }
221 :
222 :
223 0 : OUString ParameterManager::createFilterConditionFromColumnLink(
224 : const OUString& _rMasterColumn, const OUString& _rDetailLink, OUString& _rNewParamName )
225 : {
226 0 : OUString sFilter;
227 :
228 : // format is:
229 : // <detail_column> = :<new_param_name>
230 0 : sFilter = quoteName( m_sIdentifierQuoteString, _rDetailLink );
231 0 : sFilter += " = :";
232 :
233 : // generate a parameter name which is not already used
234 0 : _rNewParamName = "link_from_";
235 0 : _rNewParamName += convertName2SQLName( _rMasterColumn, m_sSpecialCharacters );
236 0 : while ( m_aParameterInformation.find( _rNewParamName ) != m_aParameterInformation.end() )
237 : {
238 0 : _rNewParamName += "_";
239 : }
240 :
241 0 : return sFilter += _rNewParamName;
242 : }
243 :
244 :
245 0 : void ParameterManager::classifyLinks( const Reference< XNameAccess >& _rxParentColumns,
246 : const Reference< XNameAccess >& _rxColumns, ::std::vector< OUString >& _out_rAdditionalFilterComponents ) SAL_THROW(( Exception ))
247 : {
248 : OSL_PRECOND( m_aMasterFields.getLength() == m_aDetailFields.getLength(),
249 : "ParameterManager::classifyLinks: master and detail fields should have the same length!" );
250 : OSL_ENSURE( _rxColumns.is(), "ParameterManager::classifyLinks: invalid columns!" );
251 :
252 0 : if ( !_rxColumns.is() )
253 0 : return;
254 :
255 : // we may need to strip any links which are invalid, so here go the containers
256 : // for temporarirly holding the new pairs
257 0 : ::std::vector< OUString > aStrippedMasterFields;
258 0 : ::std::vector< OUString > aStrippedDetailFields;
259 :
260 0 : bool bNeedExchangeLinks = false;
261 :
262 : // classify the links
263 0 : const OUString* pMasterFields = m_aMasterFields.getConstArray();
264 0 : const OUString* pDetailFields = m_aDetailFields.getConstArray();
265 0 : const OUString* pDetailFieldsEnd = pDetailFields + m_aDetailFields.getLength();
266 0 : for ( ; pDetailFields < pDetailFieldsEnd; ++pDetailFields, ++pMasterFields )
267 : {
268 0 : if ( pMasterFields->isEmpty() || pDetailFields->isEmpty() )
269 0 : continue;
270 :
271 : // if not even the master part of the relationship exists in the parent , the
272 : // link is invalid as a whole
273 : // #i63674# / 2006-03-28 / frank.schoenheit@sun.com
274 0 : if ( !_rxParentColumns->hasByName( *pMasterFields ) )
275 : {
276 0 : bNeedExchangeLinks = true;
277 0 : continue;
278 : }
279 :
280 0 : bool bValidLink = true;
281 :
282 : // is there an inner parameter with this name? That is, a parameter which is already part of
283 : // the very original statement (not the one we create ourselve, with the additional parameters)
284 0 : ParameterInformation::iterator aPos = m_aParameterInformation.find( *pDetailFields );
285 0 : if ( aPos != m_aParameterInformation.end() )
286 : { // there is an inner parameter with this name
287 0 : aPos->second.eType = eLinkedByParamName;
288 0 : aStrippedDetailFields.push_back( *pDetailFields );
289 : }
290 : else
291 : {
292 : // does the detail name denote a column?
293 0 : if ( _rxColumns->hasByName( *pDetailFields ) )
294 : {
295 0 : OUString sNewParamName;
296 0 : const OUString sFilterCondition = createFilterConditionFromColumnLink( *pMasterFields, *pDetailFields, sNewParamName );
297 : OSL_PRECOND( !sNewParamName.isEmpty(), "ParameterManager::classifyLinks: createFilterConditionFromColumnLink returned nonsense!" );
298 :
299 : // remember meta information about this new parameter
300 : ::std::pair< ParameterInformation::iterator, bool > aInsertionPos =
301 : m_aParameterInformation.insert(
302 : ParameterInformation::value_type( sNewParamName, ParameterMetaData( NULL ) )
303 0 : );
304 : OSL_ENSURE( aInsertionPos.second, "ParameterManager::classifyLinks: there already was a parameter with this name!" );
305 0 : aInsertionPos.first->second.eType = eLinkedByColumnName;
306 :
307 : // remember the filter component
308 0 : _out_rAdditionalFilterComponents.push_back( sFilterCondition );
309 :
310 : // remember the new "detail field" for this link
311 0 : aStrippedDetailFields.push_back( sNewParamName );
312 0 : bNeedExchangeLinks = true;
313 : }
314 : else
315 : {
316 : // the detail field neither denotes a column name, nor a parameter name
317 0 : bValidLink = false;
318 0 : bNeedExchangeLinks = true;
319 : }
320 : }
321 :
322 0 : if ( bValidLink )
323 0 : aStrippedMasterFields.push_back( *pMasterFields );
324 : }
325 : SAL_WARN_IF( aStrippedMasterFields.size() != aStrippedDetailFields.size(),
326 : "connectivity.commontools",
327 : "ParameterManager::classifyLinks: inconsistency in new link pairs!" );
328 :
329 0 : if ( bNeedExchangeLinks )
330 : {
331 0 : OUString *pFields = aStrippedMasterFields.empty() ? 0 : &aStrippedMasterFields[0];
332 0 : m_aMasterFields = Sequence< OUString >( pFields, aStrippedMasterFields.size() );
333 0 : pFields = aStrippedDetailFields.empty() ? 0 : &aStrippedDetailFields[0];
334 0 : m_aDetailFields = Sequence< OUString >( pFields, aStrippedDetailFields.size() );
335 0 : }
336 : }
337 :
338 :
339 0 : void ParameterManager::analyzeFieldLinks( FilterManager& _rFilterManager, bool& /* [out] */ _rColumnsInLinkDetails )
340 : {
341 : OSL_PRECOND( isAlive(), "ParameterManager::analyzeFieldLinks: not initialized, or already disposed!" );
342 0 : if ( !isAlive() )
343 0 : return;
344 :
345 0 : _rColumnsInLinkDetails = false;
346 : try
347 : {
348 : // the links as determined by the properties
349 0 : Reference< XPropertySet > xProp = m_xComponent;
350 : OSL_ENSURE(xProp.is(),"Some already released my component!");
351 0 : if ( xProp.is() )
352 : {
353 0 : xProp->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MASTERFIELDS) ) >>= m_aMasterFields;
354 0 : xProp->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DETAILFIELDS) ) >>= m_aDetailFields;
355 : }
356 :
357 : {
358 : // normalize to equal length
359 0 : sal_Int32 nMasterLength = m_aMasterFields.getLength();
360 0 : sal_Int32 nDetailLength = m_aDetailFields.getLength();
361 :
362 0 : if ( nMasterLength > nDetailLength )
363 0 : m_aMasterFields.realloc( nDetailLength );
364 0 : else if ( nDetailLength > nMasterLength )
365 0 : m_aDetailFields.realloc( nMasterLength );
366 : }
367 :
368 0 : Reference< XNameAccess > xColumns;
369 0 : if ( !getColumns( xColumns, true ) )
370 : // already asserted in getColumns
371 0 : return;
372 :
373 0 : Reference< XNameAccess > xParentColumns;
374 0 : if ( !getParentColumns( xParentColumns, true ) )
375 0 : return;
376 :
377 : // classify the links - depending on what the detail fields in each link pair denotes
378 0 : ::std::vector< OUString > aAdditionalFilterComponents;
379 0 : classifyLinks( xParentColumns, xColumns, aAdditionalFilterComponents );
380 :
381 : // did we find links where the detail field refers to a detail column (instead of a parameter name)?
382 0 : if ( !aAdditionalFilterComponents.empty() )
383 : {
384 0 : const static OUString s_sAnd( " AND " );
385 : // build a conjunction of all the filter components
386 0 : OUStringBuffer sAdditionalFilter;
387 0 : for ( ::std::vector< OUString >::const_iterator aComponent = aAdditionalFilterComponents.begin();
388 0 : aComponent != aAdditionalFilterComponents.end();
389 : ++aComponent
390 : )
391 : {
392 0 : if ( !sAdditionalFilter.isEmpty() )
393 0 : sAdditionalFilter.append(s_sAnd);
394 :
395 0 : sAdditionalFilter.appendAscii("( ",((sal_Int32)(sizeof("( ")-1)));
396 0 : sAdditionalFilter.append(*aComponent);
397 0 : sAdditionalFilter.appendAscii(" )",((sal_Int32)(sizeof(" )")-1)));
398 : }
399 :
400 : // now set this filter at the 's filter manager
401 0 : _rFilterManager.setFilterComponent( FilterManager::fcLinkFilter, sAdditionalFilter.makeStringAndClear() );
402 :
403 0 : _rColumnsInLinkDetails = true;
404 0 : }
405 : }
406 0 : catch( const Exception& )
407 : {
408 : SAL_WARN( "connectivity.commontools", "ParameterManager::analyzeFieldLinks: caught an exception!" );
409 : }
410 : }
411 :
412 :
413 0 : void ParameterManager::createOuterParameters()
414 : {
415 : OSL_PRECOND( !m_pOuterParameters.is(), "ParameterManager::createOuterParameters: outer parameters not initialized!" );
416 : OSL_PRECOND( m_xInnerParamUpdate.is(), "ParameterManager::createOuterParameters: no write access to the inner parameters!" );
417 0 : if ( !m_xInnerParamUpdate.is() )
418 0 : return;
419 :
420 0 : m_pOuterParameters = new param::ParameterWrapperContainer;
421 :
422 : #if OSL_DEBUG_LEVEL > 0
423 : sal_Int32 nSmallestIndexLinkedByColumnName = -1;
424 : sal_Int32 nLargestIndexNotLinkedByColumnName = -1;
425 : #endif
426 0 : for ( ParameterInformation::iterator aParam = m_aParameterInformation.begin();
427 0 : aParam != m_aParameterInformation.end();
428 : ++aParam
429 : )
430 : {
431 : #if OSL_DEBUG_LEVEL > 0
432 : if ( aParam->second.aInnerIndexes.size() )
433 : {
434 : if ( aParam->second.eType == eLinkedByColumnName )
435 : {
436 : if ( nSmallestIndexLinkedByColumnName == -1 )
437 : nSmallestIndexLinkedByColumnName = aParam->second.aInnerIndexes[ 0 ];
438 : }
439 : else
440 : {
441 : nLargestIndexNotLinkedByColumnName = aParam->second.aInnerIndexes[ aParam->second.aInnerIndexes.size() - 1 ];
442 : }
443 : }
444 : #endif
445 0 : if ( aParam->second.eType != eFilledExternally )
446 0 : continue;
447 :
448 : // check which of the parameters have already been visited (e.g. filled via XParameters)
449 0 : size_t nAlreadyVisited = 0;
450 0 : for ( ::std::vector< sal_Int32 >::iterator aIndex = aParam->second.aInnerIndexes.begin();
451 0 : aIndex != aParam->second.aInnerIndexes.end();
452 : ++aIndex
453 : )
454 : {
455 0 : if ( ( m_aParametersVisited.size() > (size_t)*aIndex ) && m_aParametersVisited[ *aIndex ] )
456 : { // exclude this index
457 0 : *aIndex = -1;
458 0 : ++nAlreadyVisited;
459 : }
460 : }
461 0 : if ( nAlreadyVisited == aParam->second.aInnerIndexes.size() )
462 0 : continue;
463 :
464 : // need a wrapper for this .... the "inner parameters" as supplied by a result set don't have a "Value"
465 : // property, but the parameter listeners expect such a property. So we need an object "aggregating"
466 : // xParam and supplying an additional property ("Value")
467 : // (it's no real aggregation of course ...)
468 0 : m_pOuterParameters->push_back( new param::ParameterWrapper( aParam->second.xComposerColumn, m_xInnerParamUpdate, aParam->second.aInnerIndexes ) );
469 : }
470 :
471 : #if OSL_DEBUG_LEVEL > 0
472 : OSL_ENSURE( ( nSmallestIndexLinkedByColumnName == -1 ) || ( nLargestIndexNotLinkedByColumnName == -1 ) ||
473 : ( nSmallestIndexLinkedByColumnName > nLargestIndexNotLinkedByColumnName ),
474 : "ParameterManager::createOuterParameters: inconsistency!" );
475 :
476 : // for the master-detail links, where the detail field denoted a column name, we created an additional ("artificial")
477 : // filter, and *appended* it to all other (potentially) existing filters of the row set. This means that the indexes
478 : // for the parameters resulting from the artifical filter should be larger than any other parameter index, and this
479 : // is what the assertion checks.
480 : // If the assertion fails, then we would need another handling for the "parameters visited" flags, since they're based
481 : // on parameter indexes *without* the artificial filter (because this filter is not visible from the outside).
482 : #endif
483 : }
484 :
485 :
486 0 : void ParameterManager::updateParameterInfo( FilterManager& _rFilterManager )
487 : {
488 : OSL_PRECOND( isAlive(), "ParameterManager::updateParameterInfo: not initialized, or already disposed!" );
489 0 : if ( !isAlive() )
490 0 : return;
491 :
492 0 : clearAllParameterInformation();
493 0 : cacheConnectionInfo();
494 :
495 : // check whether the is based on a statement/query which requires parameters
496 0 : Reference< XPropertySet > xProp = m_xComponent;
497 : OSL_ENSURE(xProp.is(),"Some already released my component!");
498 0 : if ( xProp.is() )
499 : {
500 0 : if ( !initializeComposerByComponent( xProp ) )
501 : { // okay, nothing to do
502 0 : m_bUpToDate = true;
503 0 : return;
504 : } // if ( !initializeComposerByComponent( m_xComponent ) )
505 : }
506 : SAL_WARN_IF( !m_xInnerParamColumns.is(),
507 : "connectivity.commontools",
508 : "ParameterManager::updateParameterInfo: initializeComposerByComponent did nonsense (1)!" );
509 :
510 : // collect all parameters which are defined by the "inner parameters"
511 0 : collectInnerParameters( false );
512 :
513 : // analyze the master-detail relationships
514 0 : bool bColumnsInLinkDetails = false;
515 0 : analyzeFieldLinks( _rFilterManager, bColumnsInLinkDetails );
516 :
517 0 : if ( bColumnsInLinkDetails )
518 : {
519 : // okay, in this case, analyzeFieldLinks modified the "real" filter at the RowSet, to contain
520 : // an additional restriction (which we created ourself)
521 : // So we need to update all information about our inner parameter columns
522 0 : Reference< XPropertySet > xDirectRowSetProps;
523 0 : m_xAggregatedRowSet->queryAggregation( ::getCppuType( &xDirectRowSetProps ) ) >>= xDirectRowSetProps;
524 0 : OSL_VERIFY( initializeComposerByComponent( xDirectRowSetProps ) );
525 0 : collectInnerParameters( true );
526 : }
527 :
528 0 : if ( !m_nInnerCount )
529 : { // no parameters at all
530 0 : m_bUpToDate = true;
531 0 : return;
532 : }
533 :
534 : // for what now remains as outer parameters, create the wrappers for the single
535 : // parameter columns
536 0 : createOuterParameters();
537 :
538 0 : m_bUpToDate = true;
539 : }
540 :
541 :
542 0 : void ParameterManager::fillLinkedParameters( const Reference< XNameAccess >& _rxParentColumns )
543 : {
544 : OSL_PRECOND( isAlive(), "ParameterManager::fillLinkedParameters: not initialized, or already disposed!" );
545 0 : if ( !isAlive() )
546 0 : return;
547 : OSL_PRECOND( m_xInnerParamColumns.is(), "ParameterManager::fillLinkedParameters: no inner parameters found!" );
548 : OSL_ENSURE ( _rxParentColumns.is(), "ParameterManager::fillLinkedParameters: invalid parent columns!" );
549 :
550 : try
551 : {
552 : // the master and detail field( name)s of the
553 0 : const OUString* pMasterFields = m_aMasterFields.getConstArray();
554 0 : const OUString* pDetailFields = m_aDetailFields.getConstArray();
555 :
556 0 : sal_Int32 nMasterLen = m_aMasterFields.getLength();
557 :
558 : // loop through all master fields. For each of them, get the respective column from the
559 : // parent , and forward its current value as paramter value to the (inner) row set
560 0 : for ( sal_Int32 i = 0; i < nMasterLen; ++i, ++pMasterFields, ++pDetailFields )
561 : {
562 : // does the name denote a valid column in the parent?
563 0 : if ( !_rxParentColumns->hasByName( *pMasterFields ) )
564 : {
565 : SAL_WARN( "connectivity.commontools", "ParameterManager::fillLinkedParameters: invalid master names should have been stripped long before!" );
566 0 : continue;
567 : }
568 :
569 : // do we, for this name, know where to place the values?
570 0 : ParameterInformation::const_iterator aParamInfo = m_aParameterInformation.find( *pDetailFields );
571 0 : if ( ( aParamInfo == m_aParameterInformation.end() )
572 0 : || ( aParamInfo->second.aInnerIndexes.empty() )
573 : )
574 : {
575 : SAL_WARN( "connectivity.commontools", "ParameterManager::fillLinkedParameters: nothing known about this detail field!" );
576 0 : continue;
577 : }
578 :
579 : // the concrete master field
580 0 : Reference< XPropertySet > xMasterField(_rxParentColumns->getByName( *pMasterFields ),UNO_QUERY);
581 :
582 : // the positions where we have to fill in values for the current parameter name
583 0 : for ( ::std::vector< sal_Int32 >::const_iterator aPosition = aParamInfo->second.aInnerIndexes.begin();
584 0 : aPosition != aParamInfo->second.aInnerIndexes.end();
585 : ++aPosition
586 : )
587 : {
588 : // the concrete detail field
589 0 : Reference< XPropertySet > xDetailField(m_xInnerParamColumns->getByIndex( *aPosition ),UNO_QUERY);
590 : OSL_ENSURE( xDetailField.is(), "ParameterManager::fillLinkedParameters: invalid detail field!" );
591 0 : if ( !xDetailField.is() )
592 0 : continue;
593 :
594 : // type and scale of the parameter field
595 0 : sal_Int32 nParamType = DataType::VARCHAR;
596 0 : OSL_VERIFY( xDetailField->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE) ) >>= nParamType );
597 :
598 0 : sal_Int32 nScale = 0;
599 0 : if ( xDetailField->getPropertySetInfo()->hasPropertyByName( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE) ) )
600 0 : OSL_VERIFY( xDetailField->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE) ) >>= nScale );
601 :
602 : // transfer the param value
603 : try
604 : {
605 0 : m_xInnerParamUpdate->setObjectWithInfo(
606 0 : *aPosition + 1, // parameters are based at 1
607 0 : xMasterField->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE) ),
608 : nParamType,
609 : nScale
610 0 : );
611 : }
612 0 : catch( const Exception& )
613 : {
614 : DBG_UNHANDLED_EXCEPTION();
615 : SAL_WARN( "connectivity.commontools", "ParameterManager::fillLinkedParameters: master-detail parameter number " <<
616 : sal_Int32( *aPosition + 1 ) << " could not be filled!" );
617 : }
618 0 : }
619 0 : }
620 : }
621 0 : catch( const Exception& )
622 : {
623 : DBG_UNHANDLED_EXCEPTION();
624 : }
625 : }
626 :
627 :
628 0 : bool ParameterManager::completeParameters( const Reference< XInteractionHandler >& _rxCompletionHandler, const Reference< XConnection > _rxConnection )
629 : {
630 : OSL_PRECOND( isAlive(), "ParameterManager::completeParameters: not initialized, or already disposed!" );
631 : OSL_ENSURE ( _rxCompletionHandler.is(), "ParameterManager::completeParameters: invalid interaction handler!" );
632 :
633 : // two continuations (Ok and Cancel)
634 0 : OInteractionAbort* pAbort = new OInteractionAbort;
635 0 : OParameterContinuation* pParams = new OParameterContinuation;
636 :
637 : // the request
638 0 : ParametersRequest aRequest;
639 0 : aRequest.Parameters = m_pOuterParameters.get();
640 0 : aRequest.Connection = _rxConnection;
641 0 : OInteractionRequest* pRequest = new OInteractionRequest( makeAny( aRequest ) );
642 0 : Reference< XInteractionRequest > xRequest( pRequest );
643 :
644 : // some knittings
645 0 : pRequest->addContinuation( pAbort );
646 0 : pRequest->addContinuation( pParams );
647 :
648 : // execute the request
649 : try
650 : {
651 0 : _rxCompletionHandler->handle( xRequest );
652 : }
653 0 : catch( const Exception& )
654 : {
655 : SAL_WARN( "connectivity.commontools", "ParameterManager::completeParameters: caught an exception while calling the handler!" );
656 : }
657 :
658 0 : if ( !pParams->wasSelected() )
659 : // canceled by the user (i.e. (s)he canceled the dialog)
660 0 : return false;
661 :
662 : try
663 : {
664 : // transfer the values from the continuation object to the parameter columns
665 0 : Sequence< PropertyValue > aFinalValues = pParams->getValues();
666 0 : const PropertyValue* pFinalValues = aFinalValues.getConstArray();
667 0 : for ( sal_Int32 i = 0; i < aFinalValues.getLength(); ++i, ++pFinalValues )
668 : {
669 0 : Reference< XPropertySet > xParamColumn(aRequest.Parameters->getByIndex( i ),UNO_QUERY);
670 0 : if ( xParamColumn.is() )
671 : {
672 : #ifdef DBG_UTIL
673 : OUString sName;
674 : xParamColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME) ) >>= sName;
675 : OSL_ENSURE( sName == pFinalValues->Name, "ParameterManager::completeParameters: inconsistent parameter names!" );
676 : #endif
677 0 : xParamColumn->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), pFinalValues->Value );
678 : // the property sets are wrapper classes, translating the Value property into a call to
679 : // the appropriate XParameters interface
680 : }
681 0 : }
682 : }
683 0 : catch( const Exception& )
684 : {
685 : SAL_WARN( "connectivity.commontools", "ParameterManager::completeParameters: caught an exception while propagating the values!" );
686 : }
687 0 : return true;
688 : }
689 :
690 :
691 0 : bool ParameterManager::consultParameterListeners( ::osl::ResettableMutexGuard& _rClearForNotifies )
692 : {
693 0 : bool bCanceled = false;
694 :
695 0 : sal_Int32 nParamsLeft = m_pOuterParameters->getParameters().size();
696 : // TODO: shouldn't we subtract all the parameters which were already visited?
697 0 : if ( nParamsLeft )
698 : {
699 0 : ::cppu::OInterfaceIteratorHelper aIter( m_aParameterListeners );
700 0 : Reference< XPropertySet > xProp = m_xComponent;
701 : OSL_ENSURE(xProp.is(),"Some already released my component!");
702 0 : DatabaseParameterEvent aEvent( xProp.get(), m_pOuterParameters.get() );
703 :
704 0 : _rClearForNotifies.clear();
705 0 : while ( aIter.hasMoreElements() && !bCanceled )
706 0 : bCanceled = !static_cast< XDatabaseParameterListener* >( aIter.next() )->approveParameter( aEvent );
707 0 : _rClearForNotifies.reset();
708 : }
709 :
710 0 : return !bCanceled;
711 : }
712 :
713 :
714 0 : bool ParameterManager::fillParameterValues( const Reference< XInteractionHandler >& _rxCompletionHandler, ::osl::ResettableMutexGuard& _rClearForNotifies )
715 : {
716 : OSL_PRECOND( isAlive(), "ParameterManager::fillParameterValues: not initialized, or already disposed!" );
717 0 : if ( !isAlive() )
718 0 : return true;
719 :
720 0 : if ( m_nInnerCount == 0 )
721 : // no parameters at all
722 0 : return true;
723 :
724 : // fill the parameters from the master-detail relationship
725 0 : Reference< XNameAccess > xParentColumns;
726 0 : if ( getParentColumns( xParentColumns, false ) && xParentColumns->hasElements() && m_aMasterFields.getLength() )
727 0 : fillLinkedParameters( xParentColumns );
728 :
729 : // let the user (via the interaction handler) fill all remaining parameters
730 0 : Reference< XConnection > xConnection;
731 0 : getConnection( xConnection );
732 :
733 0 : if ( _rxCompletionHandler.is() )
734 0 : return completeParameters( _rxCompletionHandler, xConnection );
735 :
736 0 : return consultParameterListeners( _rClearForNotifies );
737 : }
738 :
739 :
740 0 : bool ParameterManager::getConnection( Reference< XConnection >& /* [out] */ _rxConnection )
741 : {
742 : OSL_PRECOND( isAlive(), "ParameterManager::getConnection: not initialized, or already disposed!" );
743 0 : if ( !isAlive() )
744 0 : return false;
745 :
746 0 : _rxConnection.clear();
747 : try
748 : {
749 0 : Reference< XPropertySet > xProp = m_xComponent;
750 : OSL_ENSURE(xProp.is(),"Some already released my component!");
751 0 : if ( xProp.is() )
752 0 : xProp->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ACTIVE_CONNECTION) ) >>= _rxConnection;
753 : }
754 0 : catch( const Exception& )
755 : {
756 : SAL_WARN( "connectivity.commontools", "ParameterManager::getConnection: could not retrieve the connection of the !" );
757 : }
758 0 : return _rxConnection.is();
759 : }
760 :
761 :
762 0 : void ParameterManager::cacheConnectionInfo() SAL_THROW(( ))
763 : {
764 : try
765 : {
766 0 : Reference< XConnection > xConnection;
767 0 : getConnection( xConnection );
768 0 : Reference< XDatabaseMetaData > xMeta;
769 0 : if ( xConnection.is() )
770 0 : xMeta = xConnection->getMetaData();
771 0 : if ( xMeta.is() )
772 : {
773 0 : m_sIdentifierQuoteString = xMeta->getIdentifierQuoteString();
774 0 : m_sSpecialCharacters = xMeta->getExtraNameCharacters();
775 0 : }
776 : }
777 0 : catch( const Exception& )
778 : {
779 : SAL_WARN( "connectivity.commontools", "ParameterManager::cacheConnectionInfo: caught an exception!" );
780 : }
781 0 : }
782 :
783 :
784 0 : bool ParameterManager::getColumns( Reference< XNameAccess >& /* [out] */ _rxColumns, bool _bFromComposer ) SAL_THROW(( Exception ))
785 : {
786 0 : _rxColumns.clear();
787 :
788 0 : Reference< XColumnsSupplier > xColumnSupp;
789 0 : if ( _bFromComposer )
790 0 : xColumnSupp = xColumnSupp.query( m_xComposer );
791 : else
792 0 : xColumnSupp.set( m_xComponent.get(),UNO_QUERY);
793 0 : if ( xColumnSupp.is() )
794 0 : _rxColumns = xColumnSupp->getColumns();
795 : OSL_ENSURE( _rxColumns.is(), "ParameterManager::getColumns: could not retrieve the columns for the detail !" );
796 :
797 0 : return _rxColumns.is();
798 : }
799 :
800 :
801 0 : bool ParameterManager::getParentColumns( Reference< XNameAccess >& /* [out] */ _out_rxParentColumns, bool _bFromComposer )
802 : {
803 : OSL_PRECOND( isAlive(), "ParameterManager::getParentColumns: not initialized, or already disposed!" );
804 :
805 0 : _out_rxParentColumns.clear();
806 : try
807 : {
808 : // get the parent of the component we're working for
809 0 : Reference< XChild > xAsChild( m_xComponent.get(), UNO_QUERY_THROW );
810 0 : Reference< XPropertySet > xParent( xAsChild->getParent(), UNO_QUERY );
811 0 : if ( !xParent.is() )
812 0 : return false;
813 :
814 : // the columns supplier: either from a composer, or directly from the
815 0 : Reference< XColumnsSupplier > xParentColSupp;
816 0 : if ( _bFromComposer )
817 : {
818 : // re-create the parent composer all the time. Else, we'd have to bother with
819 : // being a listener at its properties, its loaded state, and event the parent-relationship.
820 : m_xParentComposer.reset(
821 : getCurrentSettingsComposer( xParent, m_xContext ),
822 : SharedQueryComposer::TakeOwnership
823 0 : );
824 0 : xParentColSupp = xParentColSupp.query( m_xParentComposer );
825 : }
826 : else
827 0 : xParentColSupp = xParentColSupp.query( xParent );
828 :
829 : // get the columns of the parent
830 0 : if ( xParentColSupp.is() )
831 0 : _out_rxParentColumns = xParentColSupp->getColumns();
832 : }
833 0 : catch( const Exception& )
834 : {
835 : SAL_WARN( "connectivity.commontools", "ParameterManager::getParentColumns: caught an exception!" );
836 : }
837 0 : return _out_rxParentColumns.is();
838 : }
839 :
840 :
841 0 : void ParameterManager::addParameterListener( const Reference< XDatabaseParameterListener >& _rxListener )
842 : {
843 0 : if ( _rxListener.is() )
844 0 : m_aParameterListeners.addInterface( _rxListener );
845 0 : }
846 :
847 :
848 0 : void ParameterManager::removeParameterListener( const Reference< XDatabaseParameterListener >& _rxListener )
849 : {
850 0 : m_aParameterListeners.removeInterface( _rxListener );
851 0 : }
852 :
853 :
854 0 : void ParameterManager::resetParameterValues( ) SAL_THROW(())
855 : {
856 : OSL_PRECOND( isAlive(), "ParameterManager::resetParameterValues: not initialized, or already disposed!" );
857 0 : if ( !isAlive() )
858 0 : return;
859 :
860 0 : if ( !m_nInnerCount )
861 : // no parameters at all
862 0 : return;
863 :
864 : try
865 : {
866 0 : Reference< XNameAccess > xColumns;
867 0 : if ( !getColumns( xColumns, false ) )
868 : // already asserted in getColumns
869 0 : return;
870 :
871 0 : Reference< XNameAccess > xParentColumns;
872 0 : if ( !getParentColumns( xParentColumns, false ) )
873 0 : return;
874 :
875 : // loop through all links pairs
876 0 : const OUString* pMasterFields = m_aMasterFields.getConstArray();
877 0 : const OUString* pDetailFields = m_aDetailFields.getConstArray();
878 :
879 0 : Reference< XPropertySet > xMasterField;
880 0 : Reference< XPropertySet > xDetailField;
881 :
882 : // now really ....
883 0 : const OUString* pDetailFieldsEnd = pDetailFields + m_aDetailFields.getLength();
884 0 : for ( ; pDetailFields < pDetailFieldsEnd; ++pDetailFields, ++pMasterFields )
885 : {
886 0 : if ( !xParentColumns->hasByName( *pMasterFields ) )
887 : {
888 : // if this name is unknown in the parent columns, then we don't have a source
889 : // for copying the value to the detail columns
890 : SAL_WARN( "connectivity.commontools", "ParameterManager::resetParameterValues: this should have been stripped long before!" );
891 0 : continue;
892 : }
893 :
894 : // for all inner parameters which are bound to the name as specified by the
895 : // slave element of the link, propagate the value from the master column to this
896 : // parameter column
897 0 : ParameterInformation::const_iterator aParamInfo = m_aParameterInformation.find( *pDetailFields );
898 0 : if ( ( aParamInfo == m_aParameterInformation.end() )
899 0 : || ( aParamInfo->second.aInnerIndexes.empty() )
900 : )
901 : {
902 : SAL_WARN( "connectivity.commontools", "ParameterManager::resetParameterValues: nothing known about this detail field!" );
903 0 : continue;
904 : }
905 :
906 0 : xParentColumns->getByName( *pMasterFields ) >>= xMasterField;
907 0 : if ( !xMasterField.is() )
908 0 : continue;
909 :
910 0 : for ( ::std::vector< sal_Int32 >::const_iterator aPosition = aParamInfo->second.aInnerIndexes.begin();
911 0 : aPosition != aParamInfo->second.aInnerIndexes.end();
912 : ++aPosition
913 : )
914 : {
915 0 : Reference< XPropertySet > xInnerParameter;
916 0 : m_xInnerParamColumns->getByIndex( *aPosition ) >>= xInnerParameter;
917 0 : if ( !xInnerParameter.is() )
918 0 : continue;
919 :
920 0 : OUString sParamColumnRealName;
921 0 : xInnerParameter->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME) ) >>= sParamColumnRealName;
922 0 : if ( xColumns->hasByName( sParamColumnRealName ) )
923 : { // our own columns have a column which's name equals the real name of the param column
924 : // -> transfer the value property
925 0 : xColumns->getByName( sParamColumnRealName ) >>= xDetailField;
926 0 : if ( xDetailField.is() )
927 0 : xDetailField->setPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE), xMasterField->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_VALUE) ) );
928 : }
929 0 : }
930 0 : }
931 : }
932 0 : catch( const Exception& )
933 : {
934 : SAL_WARN( "connectivity.commontools", "ParameterManager::resetParameterValues: caught an exception!" );
935 : }
936 :
937 : }
938 :
939 :
940 0 : void ParameterManager::externalParameterVisited( sal_Int32 _nIndex )
941 : {
942 0 : if ( m_aParametersVisited.size() < (size_t)_nIndex )
943 : {
944 0 : m_aParametersVisited.reserve( _nIndex );
945 0 : for ( sal_Int32 i = m_aParametersVisited.size(); i < _nIndex; ++i )
946 0 : m_aParametersVisited.push_back( false );
947 : }
948 0 : m_aParametersVisited[ _nIndex - 1 ] = true;
949 0 : }
950 :
951 : #define VISIT_PARAMETER( method ) \
952 : ::osl::MutexGuard aGuard( m_rMutex ); \
953 : OSL_ENSURE( m_xInnerParamUpdate.is(), "ParameterManager::XParameters::setXXX: no XParameters access to the RowSet!" ); \
954 : if ( !m_xInnerParamUpdate.is() ) \
955 : return; \
956 : m_xInnerParamUpdate->method; \
957 : externalParameterVisited( _nIndex ) \
958 :
959 :
960 0 : void ParameterManager::setNull( sal_Int32 _nIndex, sal_Int32 sqlType )
961 : {
962 0 : VISIT_PARAMETER( setNull( _nIndex, sqlType ) );
963 : }
964 :
965 :
966 0 : void ParameterManager::setObjectNull( sal_Int32 _nIndex, sal_Int32 sqlType, const OUString& typeName )
967 : {
968 0 : VISIT_PARAMETER( setObjectNull( _nIndex, sqlType, typeName ) );
969 : }
970 :
971 :
972 0 : void ParameterManager::setBoolean( sal_Int32 _nIndex, sal_Bool x )
973 : {
974 0 : VISIT_PARAMETER( setBoolean( _nIndex, x ) );
975 : }
976 :
977 :
978 0 : void ParameterManager::setByte( sal_Int32 _nIndex, sal_Int8 x )
979 : {
980 0 : VISIT_PARAMETER( setByte( _nIndex, x ) );
981 : }
982 :
983 :
984 0 : void ParameterManager::setShort( sal_Int32 _nIndex, sal_Int16 x )
985 : {
986 0 : VISIT_PARAMETER( setShort( _nIndex, x ) );
987 : }
988 :
989 :
990 0 : void ParameterManager::setInt( sal_Int32 _nIndex, sal_Int32 x )
991 : {
992 0 : VISIT_PARAMETER( setInt( _nIndex, x ) );
993 : }
994 :
995 :
996 0 : void ParameterManager::setLong( sal_Int32 _nIndex, sal_Int64 x )
997 : {
998 0 : VISIT_PARAMETER( setLong( _nIndex, x ) );
999 : }
1000 :
1001 :
1002 0 : void ParameterManager::setFloat( sal_Int32 _nIndex, float x )
1003 : {
1004 0 : VISIT_PARAMETER( setFloat( _nIndex, x ) );
1005 : }
1006 :
1007 :
1008 0 : void ParameterManager::setDouble( sal_Int32 _nIndex, double x )
1009 : {
1010 0 : VISIT_PARAMETER( setDouble( _nIndex, x ) );
1011 : }
1012 :
1013 :
1014 0 : void ParameterManager::setString( sal_Int32 _nIndex, const OUString& x )
1015 : {
1016 0 : VISIT_PARAMETER( setString( _nIndex, x ) );
1017 : }
1018 :
1019 :
1020 0 : void ParameterManager::setBytes( sal_Int32 _nIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x )
1021 : {
1022 0 : VISIT_PARAMETER( setBytes( _nIndex, x ) );
1023 : }
1024 :
1025 :
1026 0 : void ParameterManager::setDate( sal_Int32 _nIndex, const ::com::sun::star::util::Date& x )
1027 : {
1028 0 : VISIT_PARAMETER( setDate( _nIndex, x ) );
1029 : }
1030 :
1031 :
1032 0 : void ParameterManager::setTime( sal_Int32 _nIndex, const ::com::sun::star::util::Time& x )
1033 : {
1034 0 : VISIT_PARAMETER( setTime( _nIndex, x ) );
1035 : }
1036 :
1037 :
1038 0 : void ParameterManager::setTimestamp( sal_Int32 _nIndex, const ::com::sun::star::util::DateTime& x )
1039 : {
1040 0 : VISIT_PARAMETER( setTimestamp( _nIndex, x ) );
1041 : }
1042 :
1043 :
1044 0 : void ParameterManager::setBinaryStream( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length )
1045 : {
1046 0 : VISIT_PARAMETER( setBinaryStream( _nIndex, x, length ) );
1047 : }
1048 :
1049 :
1050 0 : void ParameterManager::setCharacterStream( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length )
1051 : {
1052 0 : VISIT_PARAMETER( setCharacterStream( _nIndex, x, length ) );
1053 : }
1054 :
1055 :
1056 0 : void ParameterManager::setObject( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x )
1057 : {
1058 0 : VISIT_PARAMETER( setObject( _nIndex, x ) );
1059 : }
1060 :
1061 :
1062 0 : void ParameterManager::setObjectWithInfo( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale )
1063 : {
1064 0 : VISIT_PARAMETER( setObjectWithInfo( _nIndex, x, targetSqlType, scale ) );
1065 : }
1066 :
1067 :
1068 0 : void ParameterManager::setRef( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef>& x )
1069 : {
1070 0 : VISIT_PARAMETER( setRef( _nIndex, x ) );
1071 : }
1072 :
1073 :
1074 0 : void ParameterManager::setBlob( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob>& x )
1075 : {
1076 0 : VISIT_PARAMETER( setBlob( _nIndex, x ) );
1077 : }
1078 :
1079 :
1080 0 : void ParameterManager::setClob( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob>& x )
1081 : {
1082 0 : VISIT_PARAMETER( setClob( _nIndex, x ) );
1083 : }
1084 :
1085 :
1086 0 : void ParameterManager::setArray( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray>& x )
1087 : {
1088 0 : VISIT_PARAMETER( setArray( _nIndex, x ) );
1089 : }
1090 :
1091 :
1092 0 : void ParameterManager::clearParameters( )
1093 : {
1094 0 : if ( m_xInnerParamUpdate.is() )
1095 0 : m_xInnerParamUpdate->clearParameters( );
1096 0 : }
1097 :
1098 :
1099 : //= OParameterContinuation
1100 :
1101 :
1102 0 : void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyValue >& _rValues ) throw( RuntimeException, std::exception )
1103 : {
1104 0 : m_aValues = _rValues;
1105 0 : }
1106 :
1107 :
1108 : } // namespace frm
1109 :
1110 :
1111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|