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