LCOV - code coverage report
Current view: top level - connectivity/source/commontools - parameters.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 127 424 30.0 %
Date: 2014-11-03 Functions: 17 49 34.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10