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