1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "DatabaseDataProvider.hxx"
21 #include "dbastrings.hrc"
22 #include "cppuhelper/implbase1.hxx"
23 #include <comphelper/types.hxx>
24 #include <comphelper/namedvaluecollection.hxx>
25 #include <connectivity/FValue.hxx>
26 #include <connectivity/dbtools.hxx>
27 #include <rtl/ustrbuf.hxx>
28 #include <rtl/math.hxx>
29 #include <sal/macros.h>
30 #include <tools/diagnose_ex.h>
32 #include <com/sun/star/task/XInteractionHandler.hpp>
33 #include <com/sun/star/sdb/XCompletedExecution.hpp>
34 #include <com/sun/star/sdb/CommandType.hpp>
35 #include <com/sun/star/sdbc/DataType.hpp>
36 #include <com/sun/star/sdbc/XRow.hpp>
37 #include <com/sun/star/sdbc/XResultSet.hpp>
38 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
39 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
40 #include <com/sun/star/sdbc/XColumnLocate.hpp>
41 #include <com/sun/star/beans/NamedValue.hpp>
42 #include <com/sun/star/chart/ChartDataRowSource.hpp>
43 #include <com/sun/star/chart/XChartDataArray.hpp>
44 #include <com/sun/star/chart/XDateCategories.hpp>
51 using namespace ::com::sun::star
;
52 using ::com::sun::star::sdbc::SQLException
;
53 using ::com::sun::star::uno::Reference
;
54 using ::com::sun::star::uno::RuntimeException
;
55 // -----------------------------------------------------------------------------
56 DatabaseDataProvider::DatabaseDataProvider(uno::Reference
< uno::XComponentContext
> const & context
) :
57 TDatabaseDataProvider(m_aMutex
),
58 ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>(
59 context
, static_cast< Implements
>(
60 IMPLEMENTS_PROPERTY_SET
), uno::Sequence
< ::rtl::OUString
>()),
61 m_aParameterManager( m_aMutex
, context
),
62 m_aFilterManager( uno::Reference
< lang::XMultiServiceFactory
>(context
->getServiceManager(),uno::UNO_QUERY
) ),
64 m_CommandType(sdb::CommandType::COMMAND
), // #i94114
66 m_EscapeProcessing(sal_True
),
67 m_ApplyFilter(sal_True
)
69 m_xInternal
.set( m_xContext
->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart.InternalDataProvider")),m_xContext
), uno::UNO_QUERY
);
70 m_xRangeConversion
.set(m_xInternal
,uno::UNO_QUERY
);
71 m_xComplexDescriptionAccess
.set(m_xInternal
,uno::UNO_QUERY
);
73 osl_atomic_increment( &m_refCount
);
75 m_xRowSet
.set( m_xContext
->getServiceManager()->createInstanceWithContext(SERVICE_SDB_ROWSET
,m_xContext
), uno::UNO_QUERY
);
76 m_xAggregate
.set(m_xRowSet
,uno::UNO_QUERY
);
77 m_xAggregateSet
.set(m_xRowSet
,uno::UNO_QUERY
);
78 uno::Reference
<beans::XPropertySet
> xProp(static_cast< ::cppu::OWeakObject
* >( this ),uno::UNO_QUERY
);
79 m_aFilterManager
.initialize( m_xAggregateSet
);
80 m_aParameterManager
.initialize( xProp
, m_xAggregate
);
81 m_xAggregateSet
->setPropertyValue(PROPERTY_COMMAND_TYPE
,uno::makeAny(m_CommandType
));
82 m_xAggregateSet
->setPropertyValue(PROPERTY_ESCAPE_PROCESSING
,uno::makeAny(m_EscapeProcessing
));
84 osl_atomic_decrement( &m_refCount
);
86 // -----------------------------------------------------------------------------
87 void SAL_CALL
DatabaseDataProvider::disposing()
89 lang::EventObject
aEvt(static_cast<XWeak
*>(this));
90 m_aParameterManager
.disposing( aEvt
);
92 m_aParameterManager
.dispose(); // (to free any references it may have to me)
93 m_aFilterManager
.dispose(); // (dito)
96 m_xAggregateSet
.clear();
98 m_xRangeConversion
.clear();
99 ::comphelper::disposeComponent(m_xRowSet
);
100 ::comphelper::disposeComponent(m_xInternal
);
101 m_xActiveConnection
.clear();
103 // -----------------------------------------------------------------------------
104 uno::Any
DatabaseDataProvider::queryInterface(uno::Type
const & type
) throw (uno::RuntimeException
)
106 return TDatabaseDataProvider::queryInterface(type
);
108 // -----------------------------------------------------------------------------
110 //------------------------------------------------------------------------------
111 rtl::OUString
DatabaseDataProvider::getImplementationName_Static( ) throw(uno::RuntimeException
)
113 return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.dbaccess.DatabaseDataProvider"));
115 // -----------------------------------------------------------------------------
116 // -------------------------------------------------------------------------
118 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getImplementationName( ) throw(uno::RuntimeException
)
120 return getImplementationName_Static();
122 // -----------------------------------------------------------------------------
123 // -------------------------------------------------------------------------
124 sal_Bool SAL_CALL
DatabaseDataProvider::supportsService( const ::rtl::OUString
& _rServiceName
) throw(uno::RuntimeException
)
126 return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName
, sal_True
).getLength() != 0;
128 // -----------------------------------------------------------------------------
129 //------------------------------------------------------------------------------
130 uno::Sequence
< ::rtl::OUString
> DatabaseDataProvider::getSupportedServiceNames_Static( ) throw (uno::RuntimeException
)
132 uno::Sequence
< rtl::OUString
> aSNS( 1 );
133 aSNS
[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DatabaseDataProvider"));
136 // -----------------------------------------------------------------------------
137 uno::Sequence
< ::rtl::OUString
> SAL_CALL
DatabaseDataProvider::getSupportedServiceNames( ) throw(uno::RuntimeException
)
139 return getSupportedServiceNames_Static();
141 // -----------------------------------------------------------------------------
142 uno::Reference
< uno::XInterface
> DatabaseDataProvider::Create(uno::Reference
< uno::XComponentContext
> const & context
)
144 return *(new DatabaseDataProvider(context
)) ;
146 // -----------------------------------------------------------------------------
147 // lang::XInitialization:
148 void SAL_CALL
DatabaseDataProvider::initialize(const uno::Sequence
< uno::Any
> & aArguments
) throw (uno::RuntimeException
, uno::Exception
)
150 osl::MutexGuard
g(m_aMutex
);
151 const uno::Any
* pIter
= aArguments
.getConstArray();
152 const uno::Any
* pEnd
= pIter
+ aArguments
.getLength();
153 for(;pIter
!= pEnd
;++pIter
)
155 if ( !m_xActiveConnection
.is() )
156 (*pIter
) >>= m_xActiveConnection
;
157 else if ( !m_xHandler
.is() )
158 (*pIter
) >>= m_xHandler
;
160 m_xAggregateSet
->setPropertyValue( PROPERTY_ACTIVE_CONNECTION
, uno::makeAny( m_xActiveConnection
) );
162 // -----------------------------------------------------------------------------
164 // chart2::data::XDataProvider:
165 ::sal_Bool SAL_CALL
DatabaseDataProvider::createDataSourcePossible(const uno::Sequence
< beans::PropertyValue
> & _aArguments
) throw (uno::RuntimeException
)
167 const beans::PropertyValue
* pArgIter
= _aArguments
.getConstArray();
168 const beans::PropertyValue
* pArgEnd
= pArgIter
+ _aArguments
.getLength();
169 for(;pArgIter
!= pArgEnd
;++pArgIter
)
171 if ( pArgIter
->Name
== "DataRowSource" )
173 ::com::sun::star::chart::ChartDataRowSource eRowSource
= ::com::sun::star::chart::ChartDataRowSource_COLUMNS
;
174 pArgIter
->Value
>>= eRowSource
;
175 if ( eRowSource
!= ::com::sun::star::chart::ChartDataRowSource_COLUMNS
)
178 else if ( pArgIter
->Name
== "CellRangeRepresentation" )
180 ::rtl::OUString sRange
;
181 pArgIter
->Value
>>= sRange
;
182 if ( !sRange
.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("all")) )
185 else if ( pArgIter
->Name
== "FirstCellAsLabel" )
187 sal_Bool bFirstCellAsLabel
= sal_True
;
188 pArgIter
->Value
>>= bFirstCellAsLabel
;
189 if ( !bFirstCellAsLabel
)
195 // -----------------------------------------------------------------------------
196 // -----------------------------------------------------------------------------
197 uno::Reference
< chart2::data::XDataSource
> SAL_CALL
DatabaseDataProvider::createDataSource(const uno::Sequence
< beans::PropertyValue
> & _aArguments
) throw (uno::RuntimeException
, lang::IllegalArgumentException
)
199 osl::ResettableMutexGuard
aClearForNotifies(m_aMutex
);
200 if ( createDataSourcePossible(_aArguments
) )
204 uno::Reference
< chart::XChartDataArray
> xChartData( m_xInternal
, uno::UNO_QUERY_THROW
);
205 xChartData
->setData( uno::Sequence
< uno::Sequence
< double > >() );
206 xChartData
->setColumnDescriptions( uno::Sequence
< ::rtl::OUString
>() );
207 if ( m_xInternal
->hasDataByRangeRepresentation( ::rtl::OUString::valueOf( sal_Int32(0) ) ) )
208 m_xInternal
->deleteSequence(0);
210 catch( const uno::Exception
& )
212 DBG_UNHANDLED_EXCEPTION();
215 ::comphelper::NamedValueCollection
aArgs( _aArguments
);
216 const sal_Bool bHasCategories
= aArgs
.getOrDefault( "HasCategories", sal_True
);
217 uno::Sequence
< ::rtl::OUString
> aColumnNames
=
218 aArgs
.getOrDefault( "ColumnDescriptions", uno::Sequence
< ::rtl::OUString
>() );
221 if ( !m_Command
.isEmpty() && m_xActiveConnection
.is() )
225 impl_fillRowSet_throw();
226 impl_executeRowSet_throw(aClearForNotifies
);
227 impl_fillInternalDataProvider_throw(bHasCategories
,aColumnNames
);
230 catch(const uno::Exception
& /*e*/)
234 if ( !bRet
) // no command set or an error occurred, use Internal data handler
236 uno::Reference
< lang::XInitialization
> xIni(m_xInternal
,uno::UNO_QUERY
);
239 uno::Sequence
< uno::Any
> aInitArgs(1);
240 beans::NamedValue
aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True
));
241 aInitArgs
[0] <<= aParam
;
242 xIni
->initialize(aInitArgs
);
247 return m_xInternal
->createDataSource(_aArguments
);
249 // -----------------------------------------------------------------------------
251 uno::Sequence
< beans::PropertyValue
> SAL_CALL
DatabaseDataProvider::detectArguments(const uno::Reference
< chart2::data::XDataSource
> & _xDataSource
) throw (uno::RuntimeException
)
253 ::comphelper::NamedValueCollection aArguments
;
254 aArguments
.put( "CellRangeRepresentation", uno::Any( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "all" ) ) ) );
255 aArguments
.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS
) );
256 // internal data always contains labels and categories
257 aArguments
.put( "FirstCellAsLabel", uno::makeAny( sal_True
) );
259 sal_Bool bHasCategories
= sal_False
;
260 if( _xDataSource
.is())
262 uno::Sequence
< uno::Reference
< chart2::data::XLabeledDataSequence
> > aSequences(_xDataSource
->getDataSequences());
263 const sal_Int32
nCount( aSequences
.getLength());
264 for( sal_Int32 nIdx
=0; nIdx
<nCount
; ++nIdx
)
266 if( aSequences
[nIdx
].is() )
268 uno::Reference
< beans::XPropertySet
> xSeqProp( aSequences
[nIdx
]->getValues(), uno::UNO_QUERY
);
269 ::rtl::OUString aRole
;
271 && ( xSeqProp
->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" ) ) ) >>= aRole
)
272 && aRole
== "categories"
275 bHasCategories
= sal_True
;
281 aArguments
.put( "HasCategories", uno::makeAny( bHasCategories
) );
282 return aArguments
.getPropertyValues();
284 // -----------------------------------------------------------------------------
286 ::sal_Bool SAL_CALL
DatabaseDataProvider::createDataSequenceByRangeRepresentationPossible(const ::rtl::OUString
& /*aRangeRepresentation*/) throw (uno::RuntimeException
)
290 // -----------------------------------------------------------------------------
291 uno::Any
DatabaseDataProvider::impl_getNumberFormatKey_nothrow(const ::rtl::OUString
& _sRangeRepresentation
) const
293 ::std::map
< ::rtl::OUString
,com::sun::star::uno::Any
>::const_iterator aFind
= m_aNumberFormats
.find(_sRangeRepresentation
);
294 if ( aFind
!= m_aNumberFormats
.end() )
295 return aFind
->second
;
296 return uno::makeAny(sal_Int32(0));
298 // -----------------------------------------------------------------------------
299 uno::Reference
< chart2::data::XDataSequence
> SAL_CALL
DatabaseDataProvider::createDataSequenceByRangeRepresentation(const ::rtl::OUString
& _sRangeRepresentation
) throw (uno::RuntimeException
, lang::IllegalArgumentException
)
301 osl::MutexGuard
g(m_aMutex
);
302 uno::Reference
< chart2::data::XDataSequence
> xData
= m_xInternal
->createDataSequenceByRangeRepresentation(_sRangeRepresentation
);
303 uno::Reference
<beans::XPropertySet
> xProp(xData
,uno::UNO_QUERY
);
304 const static ::rtl::OUString
s_sNumberFormatKey(RTL_CONSTASCII_USTRINGPARAM("NumberFormatKey"));
305 if ( xProp
.is() && xProp
->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey
) )
307 xProp
->setPropertyValue(s_sNumberFormatKey
,impl_getNumberFormatKey_nothrow(_sRangeRepresentation
));
312 uno::Sequence
< uno::Sequence
< rtl::OUString
> > SAL_CALL
DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException
)
314 return m_xComplexDescriptionAccess
->getComplexRowDescriptions();
316 void SAL_CALL
DatabaseDataProvider::setComplexRowDescriptions( const uno::Sequence
< uno::Sequence
< ::rtl::OUString
> >& aRowDescriptions
) throw (uno::RuntimeException
)
318 m_xComplexDescriptionAccess
->setComplexRowDescriptions(aRowDescriptions
);
320 uno::Sequence
< uno::Sequence
< rtl::OUString
> > SAL_CALL
DatabaseDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException
)
322 return m_xComplexDescriptionAccess
->getComplexColumnDescriptions();
324 void SAL_CALL
DatabaseDataProvider::setComplexColumnDescriptions( const uno::Sequence
< uno::Sequence
< rtl::OUString
> >& aColumnDescriptions
) throw (uno::RuntimeException
)
326 m_xComplexDescriptionAccess
->setComplexColumnDescriptions(aColumnDescriptions
);
328 // ____ XChartDataArray ____
329 uno::Sequence
< uno::Sequence
< double > > SAL_CALL
DatabaseDataProvider::getData() throw (uno::RuntimeException
)
331 return m_xComplexDescriptionAccess
->getData();
334 void SAL_CALL
DatabaseDataProvider::setData( const uno::Sequence
< uno::Sequence
< double > >& rDataInRows
) throw (uno::RuntimeException
)
336 m_xComplexDescriptionAccess
->setData(rDataInRows
);
339 void SAL_CALL
DatabaseDataProvider::setRowDescriptions( const uno::Sequence
< rtl::OUString
>& aRowDescriptions
) throw (uno::RuntimeException
)
341 m_xComplexDescriptionAccess
->setRowDescriptions(aRowDescriptions
);
344 void SAL_CALL
DatabaseDataProvider::setColumnDescriptions( const uno::Sequence
< rtl::OUString
>& aColumnDescriptions
) throw (uno::RuntimeException
)
346 m_xComplexDescriptionAccess
->setColumnDescriptions(aColumnDescriptions
);
349 uno::Sequence
< rtl::OUString
> SAL_CALL
DatabaseDataProvider::getRowDescriptions() throw (uno::RuntimeException
)
351 return m_xComplexDescriptionAccess
->getRowDescriptions();
354 uno::Sequence
< rtl::OUString
> SAL_CALL
DatabaseDataProvider::getColumnDescriptions() throw (uno::RuntimeException
)
356 return m_xComplexDescriptionAccess
->getColumnDescriptions();
359 // ____ XChartData (base of XChartDataArray) ____
360 void SAL_CALL
DatabaseDataProvider::addChartDataChangeEventListener(const uno::Reference
< ::com::sun::star::chart::XChartDataChangeEventListener
>& x
) throw (uno::RuntimeException
)
362 m_xComplexDescriptionAccess
->addChartDataChangeEventListener(x
);
365 void SAL_CALL
DatabaseDataProvider::removeChartDataChangeEventListener(const uno::Reference
< ::com::sun::star::chart::XChartDataChangeEventListener
>& x
) throw (uno::RuntimeException
)
367 m_xComplexDescriptionAccess
->removeChartDataChangeEventListener(x
);
370 double SAL_CALL
DatabaseDataProvider::getNotANumber() throw (uno::RuntimeException
)
372 return m_xComplexDescriptionAccess
->getNotANumber();
375 ::sal_Bool SAL_CALL
DatabaseDataProvider::isNotANumber( double nNumber
) throw (uno::RuntimeException
)
377 return m_xComplexDescriptionAccess
->isNotANumber(nNumber
);
380 // -----------------------------------------------------------------------------
382 uno::Reference
< sheet::XRangeSelection
> SAL_CALL
DatabaseDataProvider::getRangeSelection() throw (uno::RuntimeException
)
384 // TODO: Exchange the default return implementation for "getRangeSelection" !!!
385 // Exchange the default return implementation.
386 // NOTE: Default initialized polymorphic structs can cause problems because of
387 // missing default initialization of primitive types of some C++ compilers or
388 // different Any initialization in Java and C++ polymorphic structs.
389 return uno::Reference
< sheet::XRangeSelection
>();
391 // -----------------------------------------------------------------------------
392 // chart2::data::XRangeXMLConversion:
393 ::rtl::OUString SAL_CALL
DatabaseDataProvider::convertRangeToXML(const ::rtl::OUString
& _sRangeRepresentation
) throw (uno::RuntimeException
, lang::IllegalArgumentException
)
395 osl::MutexGuard
g(m_aMutex
);
396 return m_xRangeConversion
->convertRangeToXML(_sRangeRepresentation
);
398 // -----------------------------------------------------------------------------
400 ::rtl::OUString SAL_CALL
DatabaseDataProvider::convertRangeFromXML(const ::rtl::OUString
& _sXMLRange
) throw (uno::RuntimeException
, lang::IllegalArgumentException
)
402 osl::MutexGuard
g(m_aMutex
);
403 return m_xRangeConversion
->convertRangeFromXML(_sXMLRange
);
405 // -----------------------------------------------------------------------------
407 // com.sun.star.beans.XPropertySet:
408 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
DatabaseDataProvider::getPropertySetInfo() throw (uno::RuntimeException
)
410 return ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::getPropertySetInfo();
412 // -----------------------------------------------------------------------------
414 void SAL_CALL
DatabaseDataProvider::setPropertyValue(const ::rtl::OUString
& aPropertyName
, const uno::Any
& aValue
) throw (uno::RuntimeException
, beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
)
416 ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::setPropertyValue(aPropertyName
, aValue
);
418 // -----------------------------------------------------------------------------
420 uno::Any SAL_CALL
DatabaseDataProvider::getPropertyValue(const ::rtl::OUString
& aPropertyName
) throw (uno::RuntimeException
, beans::UnknownPropertyException
, lang::WrappedTargetException
)
422 return ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::getPropertyValue(aPropertyName
);
424 // -----------------------------------------------------------------------------
426 void SAL_CALL
DatabaseDataProvider::addPropertyChangeListener(const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
> & xListener
) throw (uno::RuntimeException
, beans::UnknownPropertyException
, lang::WrappedTargetException
)
428 ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::addPropertyChangeListener(aPropertyName
, xListener
);
430 // -----------------------------------------------------------------------------
432 void SAL_CALL
DatabaseDataProvider::removePropertyChangeListener(const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XPropertyChangeListener
> & xListener
) throw (uno::RuntimeException
, beans::UnknownPropertyException
, lang::WrappedTargetException
)
434 ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::removePropertyChangeListener(aPropertyName
, xListener
);
436 // -----------------------------------------------------------------------------
438 void SAL_CALL
DatabaseDataProvider::addVetoableChangeListener(const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XVetoableChangeListener
> & xListener
) throw (uno::RuntimeException
, beans::UnknownPropertyException
, lang::WrappedTargetException
)
440 ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::addVetoableChangeListener(aPropertyName
, xListener
);
442 // -----------------------------------------------------------------------------
444 void SAL_CALL
DatabaseDataProvider::removeVetoableChangeListener(const ::rtl::OUString
& aPropertyName
, const uno::Reference
< beans::XVetoableChangeListener
> & xListener
) throw (uno::RuntimeException
, beans::UnknownPropertyException
, lang::WrappedTargetException
)
446 ::cppu::PropertySetMixin
< chart2::data::XDatabaseDataProvider
>::removeVetoableChangeListener(aPropertyName
, xListener
);
448 // -----------------------------------------------------------------------------
450 // chart2::data::XDatabaseDataProvider:
451 uno::Sequence
< ::rtl::OUString
> SAL_CALL
DatabaseDataProvider::getMasterFields() throw (uno::RuntimeException
)
453 osl::MutexGuard
g(m_aMutex
);
454 return m_MasterFields
;
456 // -----------------------------------------------------------------------------
458 void SAL_CALL
DatabaseDataProvider::setMasterFields(const uno::Sequence
< ::rtl::OUString
> & the_value
) throw (uno::RuntimeException
)
460 impl_invalidateParameter_nothrow();
461 set(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MasterFields")),the_value
,m_MasterFields
);
463 // -----------------------------------------------------------------------------
465 uno::Sequence
< ::rtl::OUString
> SAL_CALL
DatabaseDataProvider::getDetailFields() throw (uno::RuntimeException
)
467 osl::MutexGuard
g(m_aMutex
);
468 return m_DetailFields
;
470 // -----------------------------------------------------------------------------
472 void SAL_CALL
DatabaseDataProvider::setDetailFields(const uno::Sequence
< ::rtl::OUString
> & the_value
) throw (uno::RuntimeException
)
474 set(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DetailFields")),the_value
,m_DetailFields
);
476 // -----------------------------------------------------------------------------
477 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getCommand() throw (uno::RuntimeException
)
479 osl::MutexGuard
g(m_aMutex
);
482 // -----------------------------------------------------------------------------
484 void SAL_CALL
DatabaseDataProvider::setCommand(const ::rtl::OUString
& the_value
) throw (uno::RuntimeException
)
487 osl::MutexGuard
g(m_aMutex
);
488 impl_invalidateParameter_nothrow();
489 m_xAggregateSet
->setPropertyValue( PROPERTY_COMMAND
, uno::makeAny( the_value
) );
491 set(PROPERTY_COMMAND
,the_value
,m_Command
);
493 // -----------------------------------------------------------------------------
495 ::sal_Int32 SAL_CALL
DatabaseDataProvider::getCommandType() throw (uno::RuntimeException
)
497 osl::MutexGuard
g(m_aMutex
);
498 return m_CommandType
;
500 // -----------------------------------------------------------------------------
502 void SAL_CALL
DatabaseDataProvider::setCommandType(::sal_Int32 the_value
) throw (uno::RuntimeException
)
505 osl::MutexGuard
g(m_aMutex
);
506 m_xAggregateSet
->setPropertyValue( PROPERTY_COMMAND_TYPE
, uno::makeAny( the_value
) );
508 set(PROPERTY_COMMAND_TYPE
,the_value
,m_CommandType
);
510 // -----------------------------------------------------------------------------
512 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getFilter() throw (uno::RuntimeException
)
514 osl::MutexGuard
g(m_aMutex
);
515 return m_aFilterManager
.getFilterComponent( dbtools::FilterManager::fcPublicFilter
);
517 // -----------------------------------------------------------------------------
519 void SAL_CALL
DatabaseDataProvider::setFilter(const ::rtl::OUString
& the_value
) throw (uno::RuntimeException
)
522 osl::MutexGuard
g(m_aMutex
);
523 m_aFilterManager
.setFilterComponent( dbtools::FilterManager::fcPublicFilter
, the_value
);
525 set(PROPERTY_FILTER
,the_value
,m_Filter
);
527 // -----------------------------------------------------------------------------
528 ::sal_Bool SAL_CALL
DatabaseDataProvider::getApplyFilter() throw (RuntimeException
)
530 osl::MutexGuard
g(m_aMutex
);
531 return m_ApplyFilter
;
533 // -----------------------------------------------------------------------------
534 void SAL_CALL
DatabaseDataProvider::setApplyFilter( ::sal_Bool the_value
) throw (RuntimeException
)
537 osl::MutexGuard
g(m_aMutex
);
538 m_xAggregateSet
->setPropertyValue( PROPERTY_APPLYFILTER
, uno::makeAny( the_value
) );
540 set(PROPERTY_APPLYFILTER
,the_value
,m_ApplyFilter
);
542 // -----------------------------------------------------------------------------
543 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getHavingClause() throw (uno::RuntimeException
)
545 osl::MutexGuard
g(m_aMutex
);
546 return m_HavingClause
;
548 // -----------------------------------------------------------------------------
549 void SAL_CALL
DatabaseDataProvider::setHavingClause( const ::rtl::OUString
& the_value
) throw (beans::UnknownPropertyException
, uno::RuntimeException
)
552 osl::MutexGuard
g(m_aMutex
);
553 m_xAggregateSet
->setPropertyValue( PROPERTY_HAVING_CLAUSE
, uno::makeAny( the_value
) );
555 set(PROPERTY_HAVING_CLAUSE
,the_value
,m_HavingClause
);
557 // -----------------------------------------------------------------------------
558 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getGroupBy() throw (uno::RuntimeException
)
560 osl::MutexGuard
g(m_aMutex
);
563 // -----------------------------------------------------------------------------
564 void SAL_CALL
DatabaseDataProvider::setGroupBy( const ::rtl::OUString
& the_value
) throw (beans::UnknownPropertyException
, uno::RuntimeException
)
567 osl::MutexGuard
g(m_aMutex
);
568 m_xAggregateSet
->setPropertyValue( PROPERTY_GROUP_BY
, uno::makeAny( the_value
) );
570 set(PROPERTY_GROUP_BY
,the_value
,m_GroupBy
);
572 // -----------------------------------------------------------------------------
573 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getOrder() throw (uno::RuntimeException
)
575 osl::MutexGuard
g(m_aMutex
);
578 // -----------------------------------------------------------------------------
579 void SAL_CALL
DatabaseDataProvider::setOrder( const ::rtl::OUString
& the_value
) throw (uno::RuntimeException
)
582 osl::MutexGuard
g(m_aMutex
);
583 m_xAggregateSet
->setPropertyValue( PROPERTY_ORDER
, uno::makeAny( the_value
) );
585 set(PROPERTY_ORDER
,the_value
,m_Order
);
587 // -----------------------------------------------------------------------------
588 ::sal_Bool SAL_CALL
DatabaseDataProvider::getEscapeProcessing() throw (uno::RuntimeException
)
590 osl::MutexGuard
g(m_aMutex
);
591 return m_EscapeProcessing
;
593 // -----------------------------------------------------------------------------
595 void SAL_CALL
DatabaseDataProvider::setEscapeProcessing(::sal_Bool the_value
) throw (uno::RuntimeException
)
597 set(PROPERTY_ESCAPE_PROCESSING
,the_value
,m_EscapeProcessing
);
599 // -----------------------------------------------------------------------------
600 ::sal_Int32 SAL_CALL
DatabaseDataProvider::getRowLimit() throw (uno::RuntimeException
)
602 osl::MutexGuard
g(m_aMutex
);
605 // -----------------------------------------------------------------------------
607 void SAL_CALL
DatabaseDataProvider::setRowLimit(::sal_Int32 the_value
) throw (uno::RuntimeException
)
609 set(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RowLimit")),the_value
,m_RowLimit
);
611 // -----------------------------------------------------------------------------
612 uno::Reference
< sdbc::XConnection
> SAL_CALL
DatabaseDataProvider::getActiveConnection() throw (uno::RuntimeException
)
614 osl::MutexGuard
g(m_aMutex
);
615 return m_xActiveConnection
;
617 // -----------------------------------------------------------------------------
619 void SAL_CALL
DatabaseDataProvider::setActiveConnection(const uno::Reference
< sdbc::XConnection
> & the_value
) throw (uno::RuntimeException
, lang::IllegalArgumentException
)
621 if ( !the_value
.is() )
622 throw lang::IllegalArgumentException();
623 set(PROPERTY_ACTIVE_CONNECTION
,the_value
,m_xActiveConnection
);
625 // -----------------------------------------------------------------------------
626 ::rtl::OUString SAL_CALL
DatabaseDataProvider::getDataSourceName() throw (uno::RuntimeException
)
628 osl::MutexGuard
g(m_aMutex
);
629 return m_DataSourceName
;
631 // -----------------------------------------------------------------------------
633 void SAL_CALL
DatabaseDataProvider::setDataSourceName(const ::rtl::OUString
& the_value
) throw (uno::RuntimeException
)
635 set(PROPERTY_DATASOURCENAME
,the_value
,m_DataSourceName
);
637 // -----------------------------------------------------------------------------
638 void DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard
& _rClearForNotifies
)
640 if ( impl_fillParameters_nothrow(_rClearForNotifies
) )
641 m_xRowSet
->execute();
644 // -----------------------------------------------------------------------------
647 struct ColumnDescription
649 ::rtl::OUString sName
;
650 sal_Int32 nResultSetPosition
;
655 ,nResultSetPosition( 0 )
656 ,nDataType( sdbc::DataType::VARCHAR
)
659 explicit ColumnDescription( const ::rtl::OUString
& i_rName
)
661 ,nResultSetPosition( 0 )
662 ,nDataType( sdbc::DataType::VARCHAR
)
667 struct CreateColumnDescription
: public ::std::unary_function
< ::rtl::OUString
, ColumnDescription
>
669 ColumnDescription
operator()( const ::rtl::OUString
& i_rName
)
671 return ColumnDescription( i_rName
);
675 struct SelectColumnName
: public ::std::unary_function
< ColumnDescription
, ::rtl::OUString
>
677 const ::rtl::OUString
& operator()( const ColumnDescription
& i_rColumn
)
679 return i_rColumn
.sName
;
684 // -----------------------------------------------------------------------------
685 void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories
,const uno::Sequence
< ::rtl::OUString
>& i_aColumnNames
)
687 // clear the data before fill the new one
688 uno::Reference
< sdbcx::XColumnsSupplier
> xColSup(m_xRowSet
,uno::UNO_QUERY_THROW
);
689 uno::Reference
< container::XNameAccess
> xColumns( xColSup
->getColumns(), uno::UNO_SET_THROW
);
690 const uno::Sequence
< ::rtl::OUString
> aRowSetColumnNames( xColumns
->getElementNames() );
692 typedef ::std::vector
< ColumnDescription
> ColumnDescriptions
;
693 ColumnDescriptions aColumns
;
694 bool bFirstColumnIsCategory
= _bHasCategories
;
695 if ( i_aColumnNames
.getLength() )
697 // some normalizations ...
698 uno::Sequence
< ::rtl::OUString
> aImposedColumnNames( i_aColumnNames
);
700 // strangely, there exist documents where the ColumnDescriptions end with a number of empty strings. /me
701 // thinks they're generated when you have a chart based on a result set with n columns, but remove some
702 // of those columns from the chart - it looks like a bug in the report XML export to me.
703 // So, get rid of the "trailing" empty columns
704 sal_Int32 nLastNonEmptyColName
= aImposedColumnNames
.getLength() - 1;
705 for ( ; nLastNonEmptyColName
>= 0; --nLastNonEmptyColName
)
707 if ( !aImposedColumnNames
[ nLastNonEmptyColName
].isEmpty() )
710 aImposedColumnNames
.realloc( nLastNonEmptyColName
+ 1 );
712 // second, for X-Y-charts the ColumnDescriptions exported by chart miss the name of the first (non-category)
713 // column. This, this results in a ColumnDescriptions array like <"", "col2", "col3">, where you'd expect
714 // <"col1", "col2", "col3">.
715 // Fix this with some heuristics:
716 if ( ( aImposedColumnNames
.getLength() > 0 ) && ( !aImposedColumnNames
[0].isEmpty() ) )
718 const sal_Int32 nAssumedRowSetColumnIndex
= _bHasCategories
? 1 : 0;
719 if ( nAssumedRowSetColumnIndex
< aRowSetColumnNames
.getLength() )
720 aImposedColumnNames
[0] = aRowSetColumnNames
[ nAssumedRowSetColumnIndex
];
723 const sal_Int32 nCount
= aImposedColumnNames
.getLength();
724 for ( sal_Int32 i
= 0 ; i
< nCount
; ++i
)
726 const ::rtl::OUString
sColumnName( aImposedColumnNames
[i
] );
727 if ( !xColumns
->hasByName( sColumnName
) )
730 if ( _bHasCategories
&& aColumns
.empty() )
732 if ( aRowSetColumnNames
.getLength() )
733 aColumns
.push_back( ColumnDescription( aRowSetColumnNames
[0] ) );
735 aColumns
.push_back( ColumnDescription( sColumnName
) );
736 bFirstColumnIsCategory
= true;
738 aColumns
.push_back( ColumnDescription( sColumnName
) );
741 if ( aColumns
.empty() )
743 aColumns
.resize( aRowSetColumnNames
.getLength() );
745 aRowSetColumnNames
.getConstArray(),
746 aRowSetColumnNames
.getConstArray() + aRowSetColumnNames
.getLength(),
748 CreateColumnDescription()
753 uno::Reference
< sdbc::XResultSet
> xRes( m_xRowSet
, uno::UNO_QUERY_THROW
);
754 uno::Reference
< sdbc::XRow
> xRow( m_xRowSet
,uno::UNO_QUERY_THROW
);
755 uno::Reference
< sdbc::XResultSetMetaDataSupplier
> xSuppMeta( m_xRowSet
,uno::UNO_QUERY_THROW
);
756 uno::Reference
< sdbc::XResultSetMetaData
> xResultSetMetaData( xSuppMeta
->getMetaData(), uno::UNO_SET_THROW
);
757 uno::Reference
< sdbc::XColumnLocate
> xColumnLocate( m_xRowSet
, uno::UNO_QUERY_THROW
);
759 for ( ColumnDescriptions::iterator col
= aColumns
.begin();
760 col
!= aColumns
.end();
764 col
->nResultSetPosition
= xColumnLocate
->findColumn( col
->sName
);
766 const uno::Reference
< beans::XPropertySet
> xColumn( xColumns
->getByName( col
->sName
), uno::UNO_QUERY_THROW
);
767 const uno::Any
aNumberFormat( xColumn
->getPropertyValue( PROPERTY_NUMBERFORMAT
) );
768 OSL_VERIFY( xColumn
->getPropertyValue( PROPERTY_TYPE
) >>= col
->nDataType
);
770 const sal_Int32 columnIndex
= col
- aColumns
.begin();
771 const ::rtl::OUString sRangeName
= ::rtl::OUString::valueOf( columnIndex
);
772 m_aNumberFormats
.insert( ::std::map
< ::rtl::OUString
, uno::Any
>::value_type( sRangeName
, aNumberFormat
) );
775 ::std::vector
< ::rtl::OUString
> aRowLabels
;
776 ::std::vector
< ::std::vector
< double > > aDataValues
;
777 sal_Int32 nRowCount
= 0;
778 ::connectivity::ORowSetValue aValue
;
779 while( xRes
->next() && (!m_RowLimit
|| nRowCount
< m_RowLimit
) )
783 aValue
.fill( aColumns
[0].nResultSetPosition
, aColumns
[0].nDataType
, xRow
);
784 aRowLabels
.push_back( aValue
.getString() );
786 ::std::vector
< double > aRow
;
787 for ( ColumnDescriptions::const_iterator col
= aColumns
.begin();
788 col
!= aColumns
.end();
792 if ( bFirstColumnIsCategory
&& ( col
== aColumns
.begin() ) )
795 aValue
.fill( col
->nResultSetPosition
, col
->nDataType
, xRow
);
796 if ( aValue
.isNull() )
799 ::rtl::math::setNan( &nValue
);
800 aRow
.push_back( nValue
);
803 aRow
.push_back( aValue
.getDouble() );
806 aDataValues
.push_back( aRow
);
809 // insert default data when no rows exist
813 const double fDefaultData
[ ] =
818 for(sal_Int32 h
= 0,k
= 0; h
< nRowCount
; ++h
,++k
)
820 aRowLabels
.push_back(::rtl::OUString::valueOf(h
+1));
821 ::std::vector
< double > aRow
;
822 const sal_Int32 nSize
= sizeof(fDefaultData
)/sizeof(fDefaultData
[0]);
823 for (size_t j
= 0; j
< (aColumns
.size()-1); ++j
,++k
)
827 aRow
.push_back(fDefaultData
[k
]);
829 aDataValues
.push_back(aRow
);
833 uno::Reference
< chart::XChartDataArray
> xData(m_xInternal
,uno::UNO_QUERY
);
834 xData
->setRowDescriptions(uno::Sequence
< ::rtl::OUString
>(&(*aRowLabels
.begin()),aRowLabels
.size()));
836 const size_t nOffset
= bFirstColumnIsCategory
? 1 : 0;
837 uno::Sequence
< ::rtl::OUString
> aColumnDescriptions( aColumns
.size() - nOffset
);
839 aColumns
.begin() + nOffset
,
841 aColumnDescriptions
.getArray(),
844 xData
->setColumnDescriptions( aColumnDescriptions
);
846 uno::Sequence
< uno::Sequence
< double > > aData(aDataValues
.size());
847 uno::Sequence
< double >* pDataIter
= aData
.getArray();
848 uno::Sequence
< double >* pDataEnd
= pDataIter
+ aData
.getLength();
849 for(sal_Int32 i
= 0;pDataIter
!= pDataEnd
; ++pDataIter
,++i
)
851 if ( !aDataValues
[i
].empty() )
852 *pDataIter
= uno::Sequence
< double >(&(*(aDataValues
[i
]).begin()),(aDataValues
[i
]).size());
854 xData
->setData(aData
);
856 // -----------------------------------------------------------------------------
857 void DatabaseDataProvider::impl_fillRowSet_throw()
859 m_xAggregateSet
->setPropertyValue( PROPERTY_FILTER
, uno::makeAny( getFilter() ) );
860 uno::Reference
< sdbc::XParameters
> xParam(m_xRowSet
,uno::UNO_QUERY_THROW
);
861 xParam
->clearParameters( );
863 // -----------------------------------------------------------------------------
864 bool DatabaseDataProvider::impl_fillParameters_nothrow( ::osl::ResettableMutexGuard
& _rClearForNotifies
)
866 // do we have to fill the parameters again?
867 if ( !m_aParameterManager
.isUpToDate() )
868 m_aParameterManager
.updateParameterInfo( m_aFilterManager
);
870 if ( m_aParameterManager
.isUpToDate() )
871 return m_aParameterManager
.fillParameterValues( m_xHandler
, _rClearForNotifies
);
875 // com::sun::star::sdbc::XParameters
876 //------------------------------------------------------------------------------
877 void SAL_CALL
DatabaseDataProvider::setNull(sal_Int32 parameterIndex
, sal_Int32 sqlType
) throw( SQLException
, RuntimeException
)
879 m_aParameterManager
.setNull(parameterIndex
, sqlType
);
882 //------------------------------------------------------------------------------
883 void SAL_CALL
DatabaseDataProvider::setObjectNull(sal_Int32 parameterIndex
, sal_Int32 sqlType
, const ::rtl::OUString
& typeName
) throw( SQLException
, RuntimeException
)
885 m_aParameterManager
.setObjectNull(parameterIndex
, sqlType
, typeName
);
888 //------------------------------------------------------------------------------
889 void SAL_CALL
DatabaseDataProvider::setBoolean(sal_Int32 parameterIndex
, sal_Bool x
) throw( SQLException
, RuntimeException
)
891 m_aParameterManager
.setBoolean(parameterIndex
, x
);
894 //------------------------------------------------------------------------------
895 void SAL_CALL
DatabaseDataProvider::setByte(sal_Int32 parameterIndex
, sal_Int8 x
) throw( SQLException
, RuntimeException
)
897 m_aParameterManager
.setByte(parameterIndex
, x
);
900 //------------------------------------------------------------------------------
901 void SAL_CALL
DatabaseDataProvider::setShort(sal_Int32 parameterIndex
, sal_Int16 x
) throw( SQLException
, RuntimeException
)
903 m_aParameterManager
.setShort(parameterIndex
, x
);
906 //------------------------------------------------------------------------------
907 void SAL_CALL
DatabaseDataProvider::setInt(sal_Int32 parameterIndex
, sal_Int32 x
) throw( SQLException
, RuntimeException
)
909 m_aParameterManager
.setInt(parameterIndex
, x
);
912 //------------------------------------------------------------------------------
913 void SAL_CALL
DatabaseDataProvider::setLong(sal_Int32 parameterIndex
, sal_Int64 x
) throw( SQLException
, RuntimeException
)
915 m_aParameterManager
.setLong(parameterIndex
, x
);
918 //------------------------------------------------------------------------------
919 void SAL_CALL
DatabaseDataProvider::setFloat(sal_Int32 parameterIndex
, float x
) throw( SQLException
, RuntimeException
)
921 m_aParameterManager
.setFloat(parameterIndex
, x
);
924 //------------------------------------------------------------------------------
925 void SAL_CALL
DatabaseDataProvider::setDouble(sal_Int32 parameterIndex
, double x
) throw( SQLException
, RuntimeException
)
927 m_aParameterManager
.setDouble(parameterIndex
, x
);
930 //------------------------------------------------------------------------------
931 void SAL_CALL
DatabaseDataProvider::setString(sal_Int32 parameterIndex
, const ::rtl::OUString
& x
) throw( SQLException
, RuntimeException
)
933 m_aParameterManager
.setString(parameterIndex
, x
);
936 //------------------------------------------------------------------------------
937 void SAL_CALL
DatabaseDataProvider::setBytes(sal_Int32 parameterIndex
, const uno::Sequence
< sal_Int8
>& x
) throw( SQLException
, RuntimeException
)
939 m_aParameterManager
.setBytes(parameterIndex
, x
);
942 //------------------------------------------------------------------------------
943 void SAL_CALL
DatabaseDataProvider::setDate(sal_Int32 parameterIndex
, const util::Date
& x
) throw( SQLException
, RuntimeException
)
945 m_aParameterManager
.setDate(parameterIndex
, x
);
948 //------------------------------------------------------------------------------
949 void SAL_CALL
DatabaseDataProvider::setTime(sal_Int32 parameterIndex
, const util::Time
& x
) throw( SQLException
, RuntimeException
)
951 m_aParameterManager
.setTime(parameterIndex
, x
);
954 //------------------------------------------------------------------------------
955 void SAL_CALL
DatabaseDataProvider::setTimestamp(sal_Int32 parameterIndex
, const util::DateTime
& x
) throw( SQLException
, RuntimeException
)
957 m_aParameterManager
.setTimestamp(parameterIndex
, x
);
960 //------------------------------------------------------------------------------
961 void SAL_CALL
DatabaseDataProvider::setBinaryStream(sal_Int32 parameterIndex
, const uno::Reference
<io::XInputStream
>& x
, sal_Int32 length
) throw( SQLException
, RuntimeException
)
963 m_aParameterManager
.setBinaryStream(parameterIndex
, x
, length
);
966 //------------------------------------------------------------------------------
967 void SAL_CALL
DatabaseDataProvider::setCharacterStream(sal_Int32 parameterIndex
, const uno::Reference
<io::XInputStream
>& x
, sal_Int32 length
) throw( SQLException
, RuntimeException
)
969 m_aParameterManager
.setCharacterStream(parameterIndex
, x
, length
);
972 //------------------------------------------------------------------------------
973 void SAL_CALL
DatabaseDataProvider::setObjectWithInfo(sal_Int32 parameterIndex
, const uno::Any
& x
, sal_Int32 targetSqlType
, sal_Int32 scale
) throw( SQLException
, RuntimeException
)
975 m_aParameterManager
.setObjectWithInfo(parameterIndex
, x
, targetSqlType
, scale
);
978 //------------------------------------------------------------------------------
979 void SAL_CALL
DatabaseDataProvider::setObject(sal_Int32 parameterIndex
, const uno::Any
& x
) throw( SQLException
, RuntimeException
)
981 m_aParameterManager
.setObject(parameterIndex
, x
);
984 //------------------------------------------------------------------------------
985 void SAL_CALL
DatabaseDataProvider::setRef(sal_Int32 parameterIndex
, const uno::Reference
<sdbc::XRef
>& x
) throw( SQLException
, RuntimeException
)
987 m_aParameterManager
.setRef(parameterIndex
, x
);
990 //------------------------------------------------------------------------------
991 void SAL_CALL
DatabaseDataProvider::setBlob(sal_Int32 parameterIndex
, const uno::Reference
<sdbc::XBlob
>& x
) throw( SQLException
, RuntimeException
)
993 m_aParameterManager
.setBlob(parameterIndex
, x
);
996 //------------------------------------------------------------------------------
997 void SAL_CALL
DatabaseDataProvider::setClob(sal_Int32 parameterIndex
, const uno::Reference
<sdbc::XClob
>& x
) throw( SQLException
, RuntimeException
)
999 m_aParameterManager
.setClob(parameterIndex
, x
);
1002 //------------------------------------------------------------------------------
1003 void SAL_CALL
DatabaseDataProvider::setArray(sal_Int32 parameterIndex
, const Reference
<sdbc::XArray
>& x
) throw( SQLException
, RuntimeException
)
1005 m_aParameterManager
.setArray(parameterIndex
, x
);
1008 //------------------------------------------------------------------------------
1009 void SAL_CALL
DatabaseDataProvider::clearParameters() throw( SQLException
, RuntimeException
)
1011 m_aParameterManager
.clearParameters();
1013 //==============================================================================
1014 // com::sun::star::sdbc::XRowSet
1015 //------------------------------------------------------------------------------
1016 void SAL_CALL
DatabaseDataProvider::execute() throw( SQLException
, RuntimeException
)
1018 uno::Sequence
< beans::PropertyValue
> aEmpty
;
1019 createDataSource(aEmpty
);
1021 //------------------------------------------------------------------------------
1022 void SAL_CALL
DatabaseDataProvider::addRowSetListener(const uno::Reference
<sdbc::XRowSetListener
>& _rListener
) throw( RuntimeException
)
1025 m_xRowSet
->addRowSetListener(_rListener
);
1028 //------------------------------------------------------------------------------
1029 void SAL_CALL
DatabaseDataProvider::removeRowSetListener(const uno::Reference
<sdbc::XRowSetListener
>& _rListener
) throw( RuntimeException
)
1032 m_xRowSet
->removeRowSetListener(_rListener
);
1034 //==============================================================================
1035 // com::sun::star::sdbc::XResultSet
1036 //------------------------------------------------------------------------------
1037 sal_Bool SAL_CALL
DatabaseDataProvider::next() throw( SQLException
, RuntimeException
)
1039 return m_xRowSet
->next();
1042 //------------------------------------------------------------------------------
1043 sal_Bool SAL_CALL
DatabaseDataProvider::isBeforeFirst() throw( SQLException
, RuntimeException
)
1045 return m_xRowSet
->isBeforeFirst();
1048 //------------------------------------------------------------------------------
1049 sal_Bool SAL_CALL
DatabaseDataProvider::isAfterLast() throw( SQLException
, RuntimeException
)
1051 return m_xRowSet
->isAfterLast();
1054 //------------------------------------------------------------------------------
1055 sal_Bool SAL_CALL
DatabaseDataProvider::isFirst() throw( SQLException
, RuntimeException
)
1057 return m_xRowSet
->isFirst();
1060 //------------------------------------------------------------------------------
1061 sal_Bool SAL_CALL
DatabaseDataProvider::isLast() throw( SQLException
, RuntimeException
)
1063 return m_xRowSet
->isLast();
1066 //------------------------------------------------------------------------------
1067 void SAL_CALL
DatabaseDataProvider::beforeFirst() throw( SQLException
, RuntimeException
)
1069 m_xRowSet
->beforeFirst();
1072 //------------------------------------------------------------------------------
1073 void SAL_CALL
DatabaseDataProvider::afterLast() throw( SQLException
, RuntimeException
)
1075 m_xRowSet
->afterLast();
1078 //------------------------------------------------------------------------------
1079 sal_Bool SAL_CALL
DatabaseDataProvider::first() throw( SQLException
, RuntimeException
)
1081 return m_xRowSet
->first();
1084 //------------------------------------------------------------------------------
1085 sal_Bool SAL_CALL
DatabaseDataProvider::last() throw( SQLException
, RuntimeException
)
1087 return m_xRowSet
->last();
1090 //------------------------------------------------------------------------------
1091 sal_Int32 SAL_CALL
DatabaseDataProvider::getRow() throw( SQLException
, RuntimeException
)
1093 return m_xRowSet
->getRow();
1096 //------------------------------------------------------------------------------
1097 sal_Bool SAL_CALL
DatabaseDataProvider::absolute(sal_Int32 row
) throw( SQLException
, RuntimeException
)
1099 return m_xRowSet
->absolute(row
);
1102 //------------------------------------------------------------------------------
1103 sal_Bool SAL_CALL
DatabaseDataProvider::relative(sal_Int32 rows
) throw( SQLException
, RuntimeException
)
1105 return m_xRowSet
->relative(rows
);
1108 //------------------------------------------------------------------------------
1109 sal_Bool SAL_CALL
DatabaseDataProvider::previous() throw( SQLException
, RuntimeException
)
1111 return m_xRowSet
->previous();
1114 //------------------------------------------------------------------------------
1115 void SAL_CALL
DatabaseDataProvider::refreshRow() throw( SQLException
, RuntimeException
)
1117 m_xRowSet
->refreshRow();
1120 //------------------------------------------------------------------------------
1121 sal_Bool SAL_CALL
DatabaseDataProvider::rowUpdated() throw( SQLException
, RuntimeException
)
1123 return m_xRowSet
->rowUpdated();
1126 //------------------------------------------------------------------------------
1127 sal_Bool SAL_CALL
DatabaseDataProvider::rowInserted() throw( SQLException
, RuntimeException
)
1129 return m_xRowSet
->rowInserted();
1132 //------------------------------------------------------------------------------
1133 sal_Bool SAL_CALL
DatabaseDataProvider::rowDeleted() throw( SQLException
, RuntimeException
)
1135 return m_xRowSet
->rowDeleted();
1138 //------------------------------------------------------------------------------
1139 uno::Reference
< uno::XInterface
> SAL_CALL
DatabaseDataProvider::getStatement() throw( SQLException
, RuntimeException
)
1141 return m_xRowSet
->getStatement();
1143 // -----------------------------------------------------------------------------
1144 uno::Reference
< uno::XInterface
> SAL_CALL
DatabaseDataProvider::getParent( ) throw (uno::RuntimeException
)
1148 // -----------------------------------------------------------------------------
1149 void SAL_CALL
DatabaseDataProvider::setParent( const uno::Reference
< uno::XInterface
>& _xParent
) throw (lang::NoSupportException
, uno::RuntimeException
)
1151 osl::MutexGuard
g(m_aMutex
);
1152 m_xParent
= _xParent
;
1154 // -----------------------------------------------------------------------------
1155 void DatabaseDataProvider::impl_invalidateParameter_nothrow()
1157 osl::MutexGuard
g(m_aMutex
);
1158 m_aParameterManager
.clearAllParameterInformation();
1160 // -----------------------------------------------------------------------------
1161 } // namespace dbaccess
1163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */