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