Coverage Report

Created: 2026-03-31 11:00

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