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