Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "DatabaseDataProvider.hxx"
21 : #include "dbastrings.hrc"
22 : #include "cppuhelper/implbase1.hxx"
23 : #include <cppuhelper/supportsservice.hxx>
24 : #include <comphelper/types.hxx>
25 : #include <comphelper/namedvaluecollection.hxx>
26 : #include <connectivity/FValue.hxx>
27 : #include <connectivity/dbtools.hxx>
28 : #include <rtl/ustrbuf.hxx>
29 : #include <rtl/math.hxx>
30 : #include <sal/macros.h>
31 : #include <tools/diagnose_ex.h>
32 :
33 : #include <com/sun/star/task/XInteractionHandler.hpp>
34 : #include <com/sun/star/sdb/XCompletedExecution.hpp>
35 : #include <com/sun/star/sdb/CommandType.hpp>
36 : #include <com/sun/star/sdbc/DataType.hpp>
37 : #include <com/sun/star/sdbc/XRow.hpp>
38 : #include <com/sun/star/sdbc/XResultSet.hpp>
39 : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
40 : #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
41 : #include <com/sun/star/sdbc/XColumnLocate.hpp>
42 : #include <com/sun/star/beans/NamedValue.hpp>
43 : #include <com/sun/star/chart/ChartDataRowSource.hpp>
44 : #include <com/sun/star/chart/XChartDataArray.hpp>
45 : #include <com/sun/star/chart/XDateCategories.hpp>
46 :
47 : #include <vector>
48 : #include <list>
49 :
50 : namespace dbaccess
51 : {
52 : using namespace ::com::sun::star;
53 : using ::com::sun::star::sdbc::SQLException;
54 : using ::com::sun::star::uno::Reference;
55 : using ::com::sun::star::uno::RuntimeException;
56 :
57 0 : DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContext > const & context) :
58 : TDatabaseDataProvider(m_aMutex),
59 : ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >(
60 : context, static_cast< Implements >(
61 : IMPLEMENTS_PROPERTY_SET), uno::Sequence< OUString >()),
62 : m_aParameterManager( m_aMutex, context ),
63 : m_aFilterManager(),
64 : m_xContext(context),
65 : m_CommandType(sdb::CommandType::COMMAND), // #i94114
66 : m_RowLimit(0),
67 : m_EscapeProcessing(sal_True),
68 0 : m_ApplyFilter(sal_True)
69 : {
70 0 : m_xInternal.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.chart.InternalDataProvider",m_xContext ), uno::UNO_QUERY );
71 0 : m_xRangeConversion.set(m_xInternal,uno::UNO_QUERY);
72 0 : m_xComplexDescriptionAccess.set(m_xInternal,uno::UNO_QUERY);
73 :
74 0 : osl_atomic_increment( &m_refCount );
75 : {
76 0 : m_xRowSet.set( m_xContext->getServiceManager()->createInstanceWithContext(SERVICE_SDB_ROWSET,m_xContext ), uno::UNO_QUERY );
77 0 : m_xAggregate.set(m_xRowSet,uno::UNO_QUERY);
78 0 : m_xAggregateSet.set(m_xRowSet,uno::UNO_QUERY);
79 0 : uno::Reference<beans::XPropertySet> xProp(static_cast< ::cppu::OWeakObject* >( this ),uno::UNO_QUERY);
80 0 : m_aFilterManager.initialize( m_xAggregateSet );
81 0 : m_aParameterManager.initialize( xProp, m_xAggregate );
82 0 : m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::makeAny(m_CommandType));
83 0 : m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::makeAny(m_EscapeProcessing));
84 : }
85 0 : osl_atomic_decrement( &m_refCount );
86 0 : }
87 :
88 0 : void SAL_CALL DatabaseDataProvider::disposing()
89 : {
90 0 : lang::EventObject aEvt(static_cast<XWeak*>(this));
91 0 : m_aParameterManager.disposing( aEvt );
92 :
93 0 : m_aParameterManager.dispose(); // (to free any references it may have to me)
94 0 : m_aFilterManager.dispose(); // (dito)
95 :
96 0 : m_xParent.clear();
97 0 : m_xAggregateSet.clear();
98 0 : m_xAggregate.clear();
99 0 : m_xRangeConversion.clear();
100 0 : ::comphelper::disposeComponent(m_xRowSet);
101 0 : ::comphelper::disposeComponent(m_xInternal);
102 0 : m_xActiveConnection.clear();
103 0 : }
104 :
105 0 : uno::Any DatabaseDataProvider::queryInterface(uno::Type const & type) throw (uno::RuntimeException, std::exception)
106 : {
107 0 : return TDatabaseDataProvider::queryInterface(type);
108 : }
109 :
110 0 : OUString DatabaseDataProvider::getImplementationName_Static( ) throw(uno::RuntimeException)
111 : {
112 0 : return OUString("com.sun.star.comp.dbaccess.DatabaseDataProvider");
113 : }
114 :
115 : // XServiceInfo
116 0 : OUString SAL_CALL DatabaseDataProvider::getImplementationName( ) throw(uno::RuntimeException, std::exception)
117 : {
118 0 : return getImplementationName_Static();
119 : }
120 :
121 0 : sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
122 : {
123 0 : return cppu::supportsService(this, _rServiceName);
124 : }
125 :
126 0 : uno::Sequence< OUString > DatabaseDataProvider::getSupportedServiceNames_Static( ) throw (uno::RuntimeException)
127 : {
128 0 : uno::Sequence< OUString > aSNS( 1 );
129 0 : aSNS[0] = "com.sun.star.chart2.data.DatabaseDataProvider";
130 0 : return aSNS;
131 : }
132 :
133 0 : uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception)
134 : {
135 0 : return getSupportedServiceNames_Static();
136 : }
137 :
138 0 : uno::Reference< uno::XInterface > DatabaseDataProvider::Create(uno::Reference< uno::XComponentContext > const & context)
139 : {
140 0 : return *(new DatabaseDataProvider(context)) ;
141 : }
142 :
143 : // lang::XInitialization:
144 0 : void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > & aArguments) throw (uno::RuntimeException, uno::Exception, std::exception)
145 : {
146 0 : osl::MutexGuard g(m_aMutex);
147 0 : const uno::Any* pIter = aArguments.getConstArray();
148 0 : const uno::Any* pEnd = pIter + aArguments.getLength();
149 0 : for(;pIter != pEnd;++pIter)
150 : {
151 0 : if ( !m_xActiveConnection.is() )
152 0 : (*pIter) >>= m_xActiveConnection;
153 0 : else if ( !m_xHandler.is() )
154 0 : (*pIter) >>= m_xHandler;
155 : }
156 0 : m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::makeAny( m_xActiveConnection ) );
157 0 : }
158 :
159 : // chart2::data::XDataProvider:
160 0 : sal_Bool SAL_CALL DatabaseDataProvider::createDataSourcePossible(const uno::Sequence< beans::PropertyValue > & _aArguments) throw (uno::RuntimeException, std::exception)
161 : {
162 0 : const beans::PropertyValue* pArgIter = _aArguments.getConstArray();
163 0 : const beans::PropertyValue* pArgEnd = pArgIter + _aArguments.getLength();
164 0 : for(;pArgIter != pArgEnd;++pArgIter)
165 : {
166 0 : if ( pArgIter->Name == "DataRowSource" )
167 : {
168 0 : ::com::sun::star::chart::ChartDataRowSource eRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
169 0 : pArgIter->Value >>= eRowSource;
170 0 : if ( eRowSource != ::com::sun::star::chart::ChartDataRowSource_COLUMNS )
171 0 : return sal_False;
172 : }
173 0 : else if ( pArgIter->Name == "CellRangeRepresentation" )
174 : {
175 0 : OUString sRange;
176 0 : pArgIter->Value >>= sRange;
177 0 : if ( sRange != "all" )
178 0 : return sal_False;
179 : }
180 0 : else if ( pArgIter->Name == "FirstCellAsLabel" )
181 : {
182 0 : sal_Bool bFirstCellAsLabel = sal_True;
183 0 : pArgIter->Value >>= bFirstCellAsLabel;
184 0 : if ( !bFirstCellAsLabel )
185 0 : return sal_False;
186 : }
187 : }
188 0 : return sal_True;
189 : }
190 :
191 0 : uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::createDataSource(const uno::Sequence< beans::PropertyValue > & _aArguments) throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
192 : {
193 0 : osl::ResettableMutexGuard aClearForNotifies(m_aMutex);
194 0 : if ( createDataSourcePossible(_aArguments) )
195 : {
196 : try
197 : {
198 0 : uno::Reference< chart::XChartDataArray> xChartData( m_xInternal, uno::UNO_QUERY_THROW );
199 0 : xChartData->setData( uno::Sequence< uno::Sequence< double > >() );
200 0 : xChartData->setColumnDescriptions( uno::Sequence< OUString >() );
201 0 : if ( m_xInternal->hasDataByRangeRepresentation( OUString::number( 0 ) ) )
202 0 : m_xInternal->deleteSequence(0);
203 : }
204 0 : catch( const uno::Exception& )
205 : {
206 : DBG_UNHANDLED_EXCEPTION();
207 : }
208 :
209 0 : ::comphelper::NamedValueCollection aArgs( _aArguments );
210 0 : const sal_Bool bHasCategories = aArgs.getOrDefault( "HasCategories", sal_True );
211 : uno::Sequence< OUString > aColumnNames =
212 0 : aArgs.getOrDefault( "ColumnDescriptions", uno::Sequence< OUString >() );
213 :
214 0 : bool bRet = false;
215 0 : if ( !m_Command.isEmpty() && m_xActiveConnection.is() )
216 : {
217 : try
218 : {
219 0 : impl_fillRowSet_throw();
220 0 : impl_executeRowSet_throw(aClearForNotifies);
221 0 : impl_fillInternalDataProvider_throw(bHasCategories,aColumnNames);
222 0 : bRet = true;
223 : }
224 0 : catch(const uno::Exception& /*e*/)
225 : {
226 : }
227 : }
228 0 : if ( !bRet ) // no command set or an error occurred, use Internal data handler
229 : {
230 0 : uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY);
231 0 : if ( xIni.is() )
232 : {
233 0 : uno::Sequence< uno::Any > aInitArgs(1);
234 0 : beans::NamedValue aParam("CreateDefaultData",uno::makeAny(sal_True));
235 0 : aInitArgs[0] <<= aParam;
236 0 : xIni->initialize(aInitArgs);
237 0 : }
238 0 : }
239 :
240 : }
241 0 : return m_xInternal->createDataSource(_aArguments);
242 : }
243 :
244 0 : uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArguments(const uno::Reference< chart2::data::XDataSource > & _xDataSource) throw (uno::RuntimeException, std::exception)
245 : {
246 0 : ::comphelper::NamedValueCollection aArguments;
247 0 : aArguments.put( "CellRangeRepresentation", uno::Any( OUString( "all" ) ) );
248 0 : aArguments.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
249 : // internal data always contains labels
250 0 : aArguments.put( "FirstCellAsLabel", uno::makeAny( sal_True ) );
251 :
252 0 : sal_Bool bHasCategories = sal_False;
253 0 : if( _xDataSource.is())
254 : {
255 0 : uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSequences(_xDataSource->getDataSequences());
256 0 : const sal_Int32 nCount( aSequences.getLength());
257 0 : for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx )
258 : {
259 0 : if( aSequences[nIdx].is() )
260 : {
261 0 : uno::Reference< beans::XPropertySet > xSeqProp( aSequences[nIdx]->getValues(), uno::UNO_QUERY );
262 0 : OUString aRole;
263 0 : if ( xSeqProp.is()
264 0 : && ( xSeqProp->getPropertyValue( "Role" ) >>= aRole )
265 0 : && aRole == "categories"
266 : )
267 : {
268 0 : bHasCategories = sal_True;
269 0 : break;
270 0 : }
271 : }
272 0 : }
273 : }
274 0 : aArguments.put( "HasCategories", uno::makeAny( bHasCategories ) );
275 0 : return aArguments.getPropertyValues();
276 : }
277 :
278 0 : sal_Bool SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentationPossible(const OUString & /*aRangeRepresentation*/) throw (uno::RuntimeException, std::exception)
279 : {
280 0 : return sal_True;
281 : }
282 :
283 0 : uno::Any DatabaseDataProvider::impl_getNumberFormatKey_nothrow(const OUString & _sRangeRepresentation) const
284 : {
285 0 : ::std::map< OUString,com::sun::star::uno::Any>::const_iterator aFind = m_aNumberFormats.find(_sRangeRepresentation);
286 0 : if ( aFind != m_aNumberFormats.end() )
287 0 : return aFind->second;
288 0 : return uno::makeAny(sal_Int32(0));
289 : }
290 :
291 0 : uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentation(const OUString & _sRangeRepresentation) throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
292 : {
293 0 : osl::MutexGuard g(m_aMutex);
294 0 : uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation);
295 0 : uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY);
296 0 : const static OUString s_sNumberFormatKey("NumberFormatKey");
297 0 : if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) )
298 : {
299 0 : xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation));
300 : }
301 0 : return xData;
302 : }
303 :
304 0 : uno::Sequence< uno::Sequence< OUString > > SAL_CALL DatabaseDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException, std::exception)
305 : {
306 0 : return m_xComplexDescriptionAccess->getComplexRowDescriptions();
307 : }
308 :
309 0 : void SAL_CALL DatabaseDataProvider::setComplexRowDescriptions( const uno::Sequence< uno::Sequence< OUString > >& aRowDescriptions ) throw (uno::RuntimeException, std::exception)
310 : {
311 0 : m_xComplexDescriptionAccess->setComplexRowDescriptions(aRowDescriptions);
312 0 : }
313 :
314 0 : uno::Sequence< uno::Sequence< OUString > > SAL_CALL DatabaseDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException, std::exception)
315 : {
316 0 : return m_xComplexDescriptionAccess->getComplexColumnDescriptions();
317 : }
318 :
319 0 : void SAL_CALL DatabaseDataProvider::setComplexColumnDescriptions( const uno::Sequence< uno::Sequence< OUString > >& aColumnDescriptions ) throw (uno::RuntimeException, std::exception)
320 : {
321 0 : m_xComplexDescriptionAccess->setComplexColumnDescriptions(aColumnDescriptions);
322 0 : }
323 :
324 : // ____ XChartDataArray ____
325 0 : uno::Sequence< uno::Sequence< double > > SAL_CALL DatabaseDataProvider::getData() throw (uno::RuntimeException, std::exception)
326 : {
327 0 : return m_xComplexDescriptionAccess->getData();
328 : }
329 :
330 0 : void SAL_CALL DatabaseDataProvider::setData( const uno::Sequence< uno::Sequence< double > >& rDataInRows ) throw (uno::RuntimeException, std::exception)
331 : {
332 0 : m_xComplexDescriptionAccess->setData(rDataInRows);
333 0 : }
334 :
335 0 : void SAL_CALL DatabaseDataProvider::setRowDescriptions( const uno::Sequence< OUString >& aRowDescriptions ) throw (uno::RuntimeException, std::exception)
336 : {
337 0 : m_xComplexDescriptionAccess->setRowDescriptions(aRowDescriptions);
338 0 : }
339 :
340 0 : void SAL_CALL DatabaseDataProvider::setColumnDescriptions( const uno::Sequence< OUString >& aColumnDescriptions ) throw (uno::RuntimeException, std::exception)
341 : {
342 0 : m_xComplexDescriptionAccess->setColumnDescriptions(aColumnDescriptions);
343 0 : }
344 :
345 0 : uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getRowDescriptions() throw (uno::RuntimeException, std::exception)
346 : {
347 0 : return m_xComplexDescriptionAccess->getRowDescriptions();
348 : }
349 :
350 0 : uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getColumnDescriptions() throw (uno::RuntimeException, std::exception)
351 : {
352 0 : return m_xComplexDescriptionAccess->getColumnDescriptions();
353 : }
354 :
355 : // ____ XChartData (base of XChartDataArray) ____
356 0 : void SAL_CALL DatabaseDataProvider::addChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x) throw (uno::RuntimeException, std::exception)
357 : {
358 0 : m_xComplexDescriptionAccess->addChartDataChangeEventListener(x);
359 0 : }
360 :
361 0 : void SAL_CALL DatabaseDataProvider::removeChartDataChangeEventListener(const uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& x) throw (uno::RuntimeException, std::exception)
362 : {
363 0 : m_xComplexDescriptionAccess->removeChartDataChangeEventListener(x);
364 0 : }
365 :
366 0 : double SAL_CALL DatabaseDataProvider::getNotANumber() throw (uno::RuntimeException, std::exception)
367 : {
368 0 : return m_xComplexDescriptionAccess->getNotANumber();
369 : }
370 :
371 0 : sal_Bool SAL_CALL DatabaseDataProvider::isNotANumber( double nNumber ) throw (uno::RuntimeException, std::exception)
372 : {
373 0 : return m_xComplexDescriptionAccess->isNotANumber(nNumber);
374 : }
375 :
376 0 : uno::Reference< sheet::XRangeSelection > SAL_CALL DatabaseDataProvider::getRangeSelection() throw (uno::RuntimeException, std::exception)
377 : {
378 : // TODO: Exchange the default return implementation for "getRangeSelection" !!!
379 : // Exchange the default return implementation.
380 : // NOTE: Default initialized polymorphic structs can cause problems because of
381 : // missing default initialization of primitive types of some C++ compilers or
382 : // different Any initialization in Java and C++ polymorphic structs.
383 0 : return uno::Reference< sheet::XRangeSelection >();
384 : }
385 :
386 : // chart2::data::XRangeXMLConversion:
387 0 : OUString SAL_CALL DatabaseDataProvider::convertRangeToXML(const OUString & _sRangeRepresentation) throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
388 : {
389 0 : osl::MutexGuard g(m_aMutex);
390 0 : return m_xRangeConversion->convertRangeToXML(_sRangeRepresentation);
391 : }
392 :
393 0 : OUString SAL_CALL DatabaseDataProvider::convertRangeFromXML(const OUString & _sXMLRange) throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
394 : {
395 0 : osl::MutexGuard g(m_aMutex);
396 0 : return m_xRangeConversion->convertRangeFromXML(_sXMLRange);
397 : }
398 :
399 : // com.sun.star.beans.XPropertySet:
400 0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL DatabaseDataProvider::getPropertySetInfo() throw (uno::RuntimeException, std::exception)
401 : {
402 0 : return ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::getPropertySetInfo();
403 : }
404 :
405 0 : void SAL_CALL DatabaseDataProvider::setPropertyValue(const OUString & aPropertyName, const uno::Any & aValue) throw (uno::RuntimeException, beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, std::exception)
406 : {
407 0 : ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::setPropertyValue(aPropertyName, aValue);
408 0 : }
409 :
410 0 : uno::Any SAL_CALL DatabaseDataProvider::getPropertyValue(const OUString & aPropertyName) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException, std::exception)
411 : {
412 0 : return ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::getPropertyValue(aPropertyName);
413 : }
414 :
415 0 : void SAL_CALL DatabaseDataProvider::addPropertyChangeListener(const OUString & aPropertyName, const uno::Reference< beans::XPropertyChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException, std::exception)
416 : {
417 0 : ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::addPropertyChangeListener(aPropertyName, xListener);
418 0 : }
419 :
420 0 : void SAL_CALL DatabaseDataProvider::removePropertyChangeListener(const OUString & aPropertyName, const uno::Reference< beans::XPropertyChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException, std::exception)
421 : {
422 0 : ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::removePropertyChangeListener(aPropertyName, xListener);
423 0 : }
424 :
425 0 : void SAL_CALL DatabaseDataProvider::addVetoableChangeListener(const OUString & aPropertyName, const uno::Reference< beans::XVetoableChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException, std::exception)
426 : {
427 0 : ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::addVetoableChangeListener(aPropertyName, xListener);
428 0 : }
429 :
430 0 : void SAL_CALL DatabaseDataProvider::removeVetoableChangeListener(const OUString & aPropertyName, const uno::Reference< beans::XVetoableChangeListener > & xListener) throw (uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException, std::exception)
431 : {
432 0 : ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >::removeVetoableChangeListener(aPropertyName, xListener);
433 0 : }
434 :
435 : // chart2::data::XDatabaseDataProvider:
436 0 : uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getMasterFields() throw (uno::RuntimeException, std::exception)
437 : {
438 0 : osl::MutexGuard g(m_aMutex);
439 0 : return m_MasterFields;
440 : }
441 :
442 0 : void SAL_CALL DatabaseDataProvider::setMasterFields(const uno::Sequence< OUString > & the_value) throw (uno::RuntimeException, std::exception)
443 : {
444 0 : impl_invalidateParameter_nothrow();
445 0 : set(OUString("MasterFields"),the_value,m_MasterFields);
446 0 : }
447 :
448 0 : uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getDetailFields() throw (uno::RuntimeException, std::exception)
449 : {
450 0 : osl::MutexGuard g(m_aMutex);
451 0 : return m_DetailFields;
452 : }
453 :
454 0 : void SAL_CALL DatabaseDataProvider::setDetailFields(const uno::Sequence< OUString > & the_value) throw (uno::RuntimeException, std::exception)
455 : {
456 0 : set("DetailFields",the_value,m_DetailFields);
457 0 : }
458 :
459 0 : OUString SAL_CALL DatabaseDataProvider::getCommand() throw (uno::RuntimeException, std::exception)
460 : {
461 0 : osl::MutexGuard g(m_aMutex);
462 0 : return m_Command;
463 : }
464 :
465 0 : void SAL_CALL DatabaseDataProvider::setCommand(const OUString & the_value) throw (uno::RuntimeException, std::exception)
466 : {
467 : {
468 0 : osl::MutexGuard g(m_aMutex);
469 0 : impl_invalidateParameter_nothrow();
470 0 : m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND, uno::makeAny( the_value ) );
471 : }
472 0 : set(PROPERTY_COMMAND,the_value,m_Command);
473 0 : }
474 :
475 0 : ::sal_Int32 SAL_CALL DatabaseDataProvider::getCommandType() throw (uno::RuntimeException, std::exception)
476 : {
477 0 : osl::MutexGuard g(m_aMutex);
478 0 : return m_CommandType;
479 : }
480 :
481 0 : void SAL_CALL DatabaseDataProvider::setCommandType(::sal_Int32 the_value) throw (uno::RuntimeException, std::exception)
482 : {
483 : {
484 0 : osl::MutexGuard g(m_aMutex);
485 0 : m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND_TYPE, uno::makeAny( the_value ) );
486 : }
487 0 : set(PROPERTY_COMMAND_TYPE,the_value,m_CommandType);
488 0 : }
489 :
490 0 : OUString SAL_CALL DatabaseDataProvider::getFilter() throw (uno::RuntimeException, std::exception)
491 : {
492 0 : osl::MutexGuard g(m_aMutex);
493 0 : return m_aFilterManager.getFilterComponent( dbtools::FilterManager::fcPublicFilter );
494 : }
495 :
496 0 : void SAL_CALL DatabaseDataProvider::setFilter(const OUString & the_value) throw (uno::RuntimeException, std::exception)
497 : {
498 : {
499 0 : osl::MutexGuard g(m_aMutex);
500 0 : m_aFilterManager.setFilterComponent( dbtools::FilterManager::fcPublicFilter, the_value );
501 : }
502 0 : set(PROPERTY_FILTER,the_value,m_Filter);
503 0 : }
504 :
505 0 : sal_Bool SAL_CALL DatabaseDataProvider::getApplyFilter() throw (RuntimeException, std::exception)
506 : {
507 0 : osl::MutexGuard g(m_aMutex);
508 0 : return m_ApplyFilter;
509 : }
510 :
511 0 : void SAL_CALL DatabaseDataProvider::setApplyFilter( sal_Bool the_value ) throw (RuntimeException, std::exception)
512 : {
513 : {
514 0 : osl::MutexGuard g(m_aMutex);
515 0 : m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( the_value ) );
516 : }
517 0 : set(PROPERTY_APPLYFILTER,the_value,m_ApplyFilter);
518 0 : }
519 :
520 0 : OUString SAL_CALL DatabaseDataProvider::getHavingClause() throw (uno::RuntimeException, std::exception)
521 : {
522 0 : osl::MutexGuard g(m_aMutex);
523 0 : return m_HavingClause;
524 : }
525 :
526 0 : void SAL_CALL DatabaseDataProvider::setHavingClause( const OUString& the_value ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
527 : {
528 : {
529 0 : osl::MutexGuard g(m_aMutex);
530 0 : m_xAggregateSet->setPropertyValue( PROPERTY_HAVING_CLAUSE, uno::makeAny( the_value ) );
531 : }
532 0 : set(PROPERTY_HAVING_CLAUSE,the_value,m_HavingClause);
533 0 : }
534 :
535 0 : OUString SAL_CALL DatabaseDataProvider::getGroupBy() throw (uno::RuntimeException, std::exception)
536 : {
537 0 : osl::MutexGuard g(m_aMutex);
538 0 : return m_GroupBy;
539 : }
540 :
541 0 : void SAL_CALL DatabaseDataProvider::setGroupBy( const OUString& the_value ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
542 : {
543 : {
544 0 : osl::MutexGuard g(m_aMutex);
545 0 : m_xAggregateSet->setPropertyValue( PROPERTY_GROUP_BY, uno::makeAny( the_value ) );
546 : }
547 0 : set(PROPERTY_GROUP_BY,the_value,m_GroupBy);
548 0 : }
549 :
550 0 : OUString SAL_CALL DatabaseDataProvider::getOrder() throw (uno::RuntimeException, std::exception)
551 : {
552 0 : osl::MutexGuard g(m_aMutex);
553 0 : return m_Order;
554 : }
555 :
556 0 : void SAL_CALL DatabaseDataProvider::setOrder( const OUString& the_value ) throw (uno::RuntimeException, std::exception)
557 : {
558 : {
559 0 : osl::MutexGuard g(m_aMutex);
560 0 : m_xAggregateSet->setPropertyValue( PROPERTY_ORDER, uno::makeAny( the_value ) );
561 : }
562 0 : set(PROPERTY_ORDER,the_value,m_Order);
563 0 : }
564 :
565 0 : sal_Bool SAL_CALL DatabaseDataProvider::getEscapeProcessing() throw (uno::RuntimeException, std::exception)
566 : {
567 0 : osl::MutexGuard g(m_aMutex);
568 0 : return m_EscapeProcessing;
569 : }
570 :
571 0 : void SAL_CALL DatabaseDataProvider::setEscapeProcessing(sal_Bool the_value) throw (uno::RuntimeException, std::exception)
572 : {
573 0 : set(PROPERTY_ESCAPE_PROCESSING,the_value,m_EscapeProcessing);
574 0 : }
575 :
576 0 : ::sal_Int32 SAL_CALL DatabaseDataProvider::getRowLimit() throw (uno::RuntimeException, std::exception)
577 : {
578 0 : osl::MutexGuard g(m_aMutex);
579 0 : return m_RowLimit;
580 : }
581 :
582 0 : void SAL_CALL DatabaseDataProvider::setRowLimit(::sal_Int32 the_value) throw (uno::RuntimeException, std::exception)
583 : {
584 0 : set("RowLimit",the_value,m_RowLimit);
585 0 : }
586 :
587 0 : uno::Reference< sdbc::XConnection > SAL_CALL DatabaseDataProvider::getActiveConnection() throw (uno::RuntimeException, std::exception)
588 : {
589 0 : osl::MutexGuard g(m_aMutex);
590 0 : return m_xActiveConnection;
591 : }
592 :
593 0 : void SAL_CALL DatabaseDataProvider::setActiveConnection(const uno::Reference< sdbc::XConnection > & the_value) throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
594 : {
595 0 : if ( !the_value.is() )
596 0 : throw lang::IllegalArgumentException();
597 0 : set(PROPERTY_ACTIVE_CONNECTION,the_value,m_xActiveConnection);
598 0 : }
599 :
600 0 : OUString SAL_CALL DatabaseDataProvider::getDataSourceName() throw (uno::RuntimeException, std::exception)
601 : {
602 0 : osl::MutexGuard g(m_aMutex);
603 0 : return m_DataSourceName;
604 : }
605 :
606 0 : void SAL_CALL DatabaseDataProvider::setDataSourceName(const OUString& the_value) throw (uno::RuntimeException, std::exception)
607 : {
608 0 : set(PROPERTY_DATASOURCENAME,the_value,m_DataSourceName);
609 0 : }
610 :
611 0 : void DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies)
612 : {
613 0 : if ( impl_fillParameters_nothrow(_rClearForNotifies) )
614 0 : m_xRowSet->execute();
615 0 : }
616 :
617 : namespace
618 : {
619 0 : struct ColumnDescription
620 : {
621 : OUString sName;
622 : sal_Int32 nResultSetPosition;
623 : sal_Int32 nDataType;
624 :
625 0 : ColumnDescription()
626 : :sName()
627 : ,nResultSetPosition( 0 )
628 0 : ,nDataType( sdbc::DataType::VARCHAR )
629 : {
630 0 : }
631 0 : explicit ColumnDescription( const OUString& i_rName )
632 : :sName( i_rName )
633 : ,nResultSetPosition( 0 )
634 0 : ,nDataType( sdbc::DataType::VARCHAR )
635 : {
636 0 : }
637 : };
638 :
639 : struct CreateColumnDescription : public ::std::unary_function< OUString, ColumnDescription >
640 : {
641 0 : ColumnDescription operator()( const OUString& i_rName )
642 : {
643 0 : return ColumnDescription( i_rName );
644 : }
645 : };
646 :
647 : struct SelectColumnName : public ::std::unary_function< ColumnDescription, OUString >
648 : {
649 0 : const OUString& operator()( const ColumnDescription& i_rColumn )
650 : {
651 0 : return i_rColumn.sName;
652 : }
653 : };
654 : }
655 :
656 0 : void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const uno::Sequence< OUString >& i_aColumnNames)
657 : {
658 : // clear the data before fill the new one
659 0 : uno::Reference< sdbcx::XColumnsSupplier > xColSup(m_xRowSet,uno::UNO_QUERY_THROW);
660 0 : uno::Reference< container::XNameAccess > xColumns( xColSup->getColumns(), uno::UNO_SET_THROW );
661 0 : const uno::Sequence< OUString > aRowSetColumnNames( xColumns->getElementNames() );
662 :
663 : typedef ::std::vector< ColumnDescription > ColumnDescriptions;
664 0 : ColumnDescriptions aColumns;
665 0 : bool bFirstColumnIsCategory = _bHasCategories;
666 0 : if ( i_aColumnNames.getLength() )
667 : {
668 : // some normalizations ...
669 0 : uno::Sequence< OUString > aImposedColumnNames( i_aColumnNames );
670 :
671 : // strangely, there exist documents where the ColumnDescriptions end with a number of empty strings. /me
672 : // thinks they're generated when you have a chart based on a result set with n columns, but remove some
673 : // of those columns from the chart - it looks like a bug in the report XML export to me.
674 : // So, get rid of the "trailing" empty columns
675 0 : sal_Int32 nLastNonEmptyColName = aImposedColumnNames.getLength() - 1;
676 0 : for ( ; nLastNonEmptyColName >= 0; --nLastNonEmptyColName )
677 : {
678 0 : if ( !aImposedColumnNames[ nLastNonEmptyColName ].isEmpty() )
679 0 : break;
680 : }
681 0 : aImposedColumnNames.realloc( nLastNonEmptyColName + 1 );
682 :
683 : // second, for X-Y-charts the ColumnDescriptions exported by chart miss the name of the first (non-category)
684 : // column. This, this results in a ColumnDescriptions array like <"", "col2", "col3">, where you'd expect
685 : // <"col1", "col2", "col3">.
686 : // Fix this with some heuristics:
687 0 : if ( ( aImposedColumnNames.getLength() > 0 ) && ( !aImposedColumnNames[0].isEmpty() ) )
688 : {
689 0 : const sal_Int32 nAssumedRowSetColumnIndex = _bHasCategories ? 1 : 0;
690 0 : if ( nAssumedRowSetColumnIndex < aRowSetColumnNames.getLength() )
691 0 : aImposedColumnNames[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ];
692 : }
693 :
694 0 : const sal_Int32 nCount = aImposedColumnNames.getLength();
695 0 : for ( sal_Int32 i = 0 ; i < nCount; ++i )
696 : {
697 0 : const OUString sColumnName( aImposedColumnNames[i] );
698 0 : if ( !xColumns->hasByName( sColumnName ) )
699 0 : continue;
700 :
701 0 : if ( _bHasCategories && aColumns.empty() )
702 : {
703 0 : if ( aRowSetColumnNames.getLength() )
704 0 : aColumns.push_back( ColumnDescription( aRowSetColumnNames[0] ) );
705 : else
706 0 : aColumns.push_back( ColumnDescription( sColumnName ) );
707 0 : bFirstColumnIsCategory = true;
708 : }
709 0 : aColumns.push_back( ColumnDescription( sColumnName ) );
710 0 : }
711 : }
712 0 : if ( aColumns.empty() )
713 : {
714 0 : aColumns.resize( aRowSetColumnNames.getLength() );
715 : ::std::transform(
716 : aRowSetColumnNames.getConstArray(),
717 0 : aRowSetColumnNames.getConstArray() + aRowSetColumnNames.getLength(),
718 : aColumns.begin(),
719 : CreateColumnDescription()
720 0 : );
721 : }
722 :
723 : // fill the data
724 0 : uno::Reference< sdbc::XResultSet> xRes( m_xRowSet, uno::UNO_QUERY_THROW );
725 0 : uno::Reference< sdbc::XRow> xRow( m_xRowSet,uno::UNO_QUERY_THROW );
726 0 : uno::Reference< sdbc::XResultSetMetaDataSupplier > xSuppMeta( m_xRowSet,uno::UNO_QUERY_THROW );
727 0 : uno::Reference< sdbc::XResultSetMetaData > xResultSetMetaData( xSuppMeta->getMetaData(), uno::UNO_SET_THROW );
728 0 : uno::Reference< sdbc::XColumnLocate > xColumnLocate( m_xRowSet, uno::UNO_QUERY_THROW );
729 :
730 0 : for ( ColumnDescriptions::iterator col = aColumns.begin();
731 0 : col != aColumns.end();
732 : ++col
733 : )
734 : {
735 0 : col->nResultSetPosition = xColumnLocate->findColumn( col->sName );
736 :
737 0 : const uno::Reference< beans::XPropertySet > xColumn( xColumns->getByName( col->sName ), uno::UNO_QUERY_THROW );
738 0 : const uno::Any aNumberFormat( xColumn->getPropertyValue( PROPERTY_NUMBERFORMAT ) );
739 0 : OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_TYPE ) >>= col->nDataType );
740 :
741 0 : const sal_Int32 columnIndex = col - aColumns.begin();
742 0 : const OUString sRangeName = OUString::number( columnIndex );
743 0 : m_aNumberFormats.insert( ::std::map< OUString, uno::Any >::value_type( sRangeName, aNumberFormat ) );
744 0 : }
745 :
746 0 : ::std::vector< OUString > aRowLabels;
747 0 : ::std::vector< ::std::vector< double > > aDataValues;
748 0 : sal_Int32 nRowCount = 0;
749 0 : ::connectivity::ORowSetValue aValue;
750 0 : while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) )
751 : {
752 0 : ++nRowCount;
753 :
754 0 : aValue.fill( aColumns[0].nResultSetPosition, aColumns[0].nDataType, xRow );
755 0 : aRowLabels.push_back( aValue.getString() );
756 :
757 0 : ::std::vector< double > aRow;
758 0 : for ( ColumnDescriptions::const_iterator col = aColumns.begin();
759 0 : col != aColumns.end();
760 : ++col
761 : )
762 : {
763 0 : if ( bFirstColumnIsCategory && ( col == aColumns.begin() ) )
764 0 : continue;
765 :
766 0 : aValue.fill( col->nResultSetPosition, col->nDataType, xRow );
767 0 : if ( aValue.isNull() )
768 : {
769 : double nValue;
770 0 : ::rtl::math::setNan( &nValue );
771 0 : aRow.push_back( nValue );
772 : }
773 : else
774 0 : aRow.push_back( aValue.getDouble() );
775 : }
776 :
777 0 : aDataValues.push_back( aRow );
778 0 : }
779 :
780 : // insert default data when no rows exist
781 0 : if ( !nRowCount )
782 : {
783 0 : nRowCount = 3;
784 : const double fDefaultData[ ] =
785 : { 9.10, 3.20, 4.54,
786 : 2.40, 8.80, 9.65,
787 : 3.10, 1.50, 3.70,
788 0 : 4.30, 9.02, 6.20 };
789 0 : for(sal_Int32 h = 0,k = 0; h < nRowCount; ++h,++k )
790 : {
791 0 : aRowLabels.push_back(OUString::number(h+1));
792 0 : ::std::vector< double > aRow;
793 0 : const sal_Int32 nSize = sizeof(fDefaultData)/sizeof(fDefaultData[0]);
794 0 : for (size_t j = 0; j < (aColumns.size()-1); ++j,++k)
795 : {
796 0 : if ( k >= nSize )
797 0 : k = 0;
798 0 : aRow.push_back(fDefaultData[k]);
799 : }
800 0 : aDataValues.push_back(aRow);
801 0 : }
802 : }
803 :
804 0 : uno::Reference< chart::XChartDataArray> xData(m_xInternal,uno::UNO_QUERY);
805 0 : xData->setRowDescriptions(uno::Sequence< OUString >(&(*aRowLabels.begin()),aRowLabels.size()));
806 :
807 0 : const size_t nOffset = bFirstColumnIsCategory ? 1 : 0;
808 0 : uno::Sequence< OUString > aColumnDescriptions( aColumns.size() - nOffset );
809 : ::std::transform(
810 : aColumns.begin() + nOffset,
811 : aColumns.end(),
812 : aColumnDescriptions.getArray(),
813 : SelectColumnName()
814 0 : );
815 0 : xData->setColumnDescriptions( aColumnDescriptions );
816 :
817 0 : uno::Sequence< uno::Sequence< double > > aData(aDataValues.size());
818 0 : uno::Sequence< double >* pDataIter = aData.getArray();
819 0 : uno::Sequence< double >* pDataEnd = pDataIter + aData.getLength();
820 0 : for(sal_Int32 i= 0;pDataIter != pDataEnd; ++pDataIter,++i )
821 : {
822 0 : if ( !aDataValues[i].empty() )
823 0 : *pDataIter = uno::Sequence< double >(&(*(aDataValues[i]).begin()),(aDataValues[i]).size());
824 : }
825 0 : xData->setData(aData);
826 0 : }
827 :
828 0 : void DatabaseDataProvider::impl_fillRowSet_throw()
829 : {
830 0 : m_xAggregateSet->setPropertyValue( PROPERTY_FILTER, uno::makeAny( getFilter() ) );
831 0 : uno::Reference< sdbc::XParameters> xParam(m_xRowSet,uno::UNO_QUERY_THROW);
832 0 : xParam->clearParameters( );
833 0 : }
834 :
835 0 : bool DatabaseDataProvider::impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies)
836 : {
837 : // do we have to fill the parameters again?
838 0 : if ( !m_aParameterManager.isUpToDate() )
839 0 : m_aParameterManager.updateParameterInfo( m_aFilterManager );
840 :
841 0 : if ( m_aParameterManager.isUpToDate() )
842 0 : return m_aParameterManager.fillParameterValues( m_xHandler, _rClearForNotifies );
843 :
844 0 : return true;
845 : }
846 :
847 : // com::sun::star::sdbc::XParameters
848 0 : void SAL_CALL DatabaseDataProvider::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw( SQLException, RuntimeException, std::exception )
849 : {
850 0 : m_aParameterManager.setNull(parameterIndex, sqlType);
851 0 : }
852 :
853 0 : void SAL_CALL DatabaseDataProvider::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName) throw( SQLException, RuntimeException, std::exception )
854 : {
855 0 : m_aParameterManager.setObjectNull(parameterIndex, sqlType, typeName);
856 0 : }
857 :
858 0 : void SAL_CALL DatabaseDataProvider::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw( SQLException, RuntimeException, std::exception )
859 : {
860 0 : m_aParameterManager.setBoolean(parameterIndex, x);
861 0 : }
862 :
863 0 : void SAL_CALL DatabaseDataProvider::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw( SQLException, RuntimeException, std::exception )
864 : {
865 0 : m_aParameterManager.setByte(parameterIndex, x);
866 0 : }
867 :
868 0 : void SAL_CALL DatabaseDataProvider::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw( SQLException, RuntimeException, std::exception )
869 : {
870 0 : m_aParameterManager.setShort(parameterIndex, x);
871 0 : }
872 :
873 0 : void SAL_CALL DatabaseDataProvider::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw( SQLException, RuntimeException, std::exception )
874 : {
875 0 : m_aParameterManager.setInt(parameterIndex, x);
876 0 : }
877 :
878 0 : void SAL_CALL DatabaseDataProvider::setLong(sal_Int32 parameterIndex, sal_Int64 x) throw( SQLException, RuntimeException, std::exception )
879 : {
880 0 : m_aParameterManager.setLong(parameterIndex, x);
881 0 : }
882 :
883 0 : void SAL_CALL DatabaseDataProvider::setFloat(sal_Int32 parameterIndex, float x) throw( SQLException, RuntimeException, std::exception )
884 : {
885 0 : m_aParameterManager.setFloat(parameterIndex, x);
886 0 : }
887 :
888 0 : void SAL_CALL DatabaseDataProvider::setDouble(sal_Int32 parameterIndex, double x) throw( SQLException, RuntimeException, std::exception )
889 : {
890 0 : m_aParameterManager.setDouble(parameterIndex, x);
891 0 : }
892 :
893 0 : void SAL_CALL DatabaseDataProvider::setString(sal_Int32 parameterIndex, const OUString& x) throw( SQLException, RuntimeException, std::exception )
894 : {
895 0 : m_aParameterManager.setString(parameterIndex, x);
896 0 : }
897 :
898 0 : void SAL_CALL DatabaseDataProvider::setBytes(sal_Int32 parameterIndex, const uno::Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException, std::exception )
899 : {
900 0 : m_aParameterManager.setBytes(parameterIndex, x);
901 0 : }
902 :
903 0 : void SAL_CALL DatabaseDataProvider::setDate(sal_Int32 parameterIndex, const util::Date& x) throw( SQLException, RuntimeException, std::exception )
904 : {
905 0 : m_aParameterManager.setDate(parameterIndex, x);
906 0 : }
907 :
908 0 : void SAL_CALL DatabaseDataProvider::setTime(sal_Int32 parameterIndex, const util::Time& x) throw( SQLException, RuntimeException, std::exception )
909 : {
910 0 : m_aParameterManager.setTime(parameterIndex, x);
911 0 : }
912 :
913 0 : void SAL_CALL DatabaseDataProvider::setTimestamp(sal_Int32 parameterIndex, const util::DateTime& x) throw( SQLException, RuntimeException, std::exception )
914 : {
915 0 : m_aParameterManager.setTimestamp(parameterIndex, x);
916 0 : }
917 :
918 0 : void SAL_CALL DatabaseDataProvider::setBinaryStream(sal_Int32 parameterIndex, const uno::Reference<io::XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException, std::exception )
919 : {
920 0 : m_aParameterManager.setBinaryStream(parameterIndex, x, length);
921 0 : }
922 :
923 0 : void SAL_CALL DatabaseDataProvider::setCharacterStream(sal_Int32 parameterIndex, const uno::Reference<io::XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException, std::exception )
924 : {
925 0 : m_aParameterManager.setCharacterStream(parameterIndex, x, length);
926 0 : }
927 :
928 0 : void SAL_CALL DatabaseDataProvider::setObjectWithInfo(sal_Int32 parameterIndex, const uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw( SQLException, RuntimeException, std::exception )
929 : {
930 0 : m_aParameterManager.setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
931 0 : }
932 :
933 0 : void SAL_CALL DatabaseDataProvider::setObject(sal_Int32 parameterIndex, const uno::Any& x) throw( SQLException, RuntimeException, std::exception )
934 : {
935 0 : m_aParameterManager.setObject(parameterIndex, x);
936 0 : }
937 :
938 0 : void SAL_CALL DatabaseDataProvider::setRef(sal_Int32 parameterIndex, const uno::Reference<sdbc::XRef>& x) throw( SQLException, RuntimeException, std::exception )
939 : {
940 0 : m_aParameterManager.setRef(parameterIndex, x);
941 0 : }
942 :
943 0 : void SAL_CALL DatabaseDataProvider::setBlob(sal_Int32 parameterIndex, const uno::Reference<sdbc::XBlob>& x) throw( SQLException, RuntimeException, std::exception )
944 : {
945 0 : m_aParameterManager.setBlob(parameterIndex, x);
946 0 : }
947 :
948 0 : void SAL_CALL DatabaseDataProvider::setClob(sal_Int32 parameterIndex, const uno::Reference<sdbc::XClob>& x) throw( SQLException, RuntimeException, std::exception )
949 : {
950 0 : m_aParameterManager.setClob(parameterIndex, x);
951 0 : }
952 :
953 0 : void SAL_CALL DatabaseDataProvider::setArray(sal_Int32 parameterIndex, const Reference<sdbc::XArray>& x) throw( SQLException, RuntimeException, std::exception )
954 : {
955 0 : m_aParameterManager.setArray(parameterIndex, x);
956 0 : }
957 :
958 0 : void SAL_CALL DatabaseDataProvider::clearParameters() throw( SQLException, RuntimeException, std::exception )
959 : {
960 0 : m_aParameterManager.clearParameters();
961 0 : }
962 :
963 : // com::sun::star::sdbc::XRowSet
964 0 : void SAL_CALL DatabaseDataProvider::execute() throw( SQLException, RuntimeException, std::exception )
965 : {
966 0 : uno::Sequence< beans::PropertyValue > aEmpty;
967 0 : createDataSource(aEmpty);
968 0 : }
969 :
970 0 : void SAL_CALL DatabaseDataProvider::addRowSetListener(const uno::Reference<sdbc::XRowSetListener>& _rListener) throw( RuntimeException, std::exception )
971 : {
972 0 : if (m_xRowSet.is())
973 0 : m_xRowSet->addRowSetListener(_rListener);
974 0 : }
975 :
976 0 : void SAL_CALL DatabaseDataProvider::removeRowSetListener(const uno::Reference<sdbc::XRowSetListener>& _rListener) throw( RuntimeException, std::exception )
977 : {
978 0 : if (m_xRowSet.is())
979 0 : m_xRowSet->removeRowSetListener(_rListener);
980 0 : }
981 :
982 : // com::sun::star::sdbc::XResultSet
983 0 : sal_Bool SAL_CALL DatabaseDataProvider::next() throw( SQLException, RuntimeException, std::exception )
984 : {
985 0 : return m_xRowSet->next();
986 : }
987 :
988 0 : sal_Bool SAL_CALL DatabaseDataProvider::isBeforeFirst() throw( SQLException, RuntimeException, std::exception )
989 : {
990 0 : return m_xRowSet->isBeforeFirst();
991 : }
992 :
993 0 : sal_Bool SAL_CALL DatabaseDataProvider::isAfterLast() throw( SQLException, RuntimeException, std::exception )
994 : {
995 0 : return m_xRowSet->isAfterLast();
996 : }
997 :
998 0 : sal_Bool SAL_CALL DatabaseDataProvider::isFirst() throw( SQLException, RuntimeException, std::exception )
999 : {
1000 0 : return m_xRowSet->isFirst();
1001 : }
1002 :
1003 0 : sal_Bool SAL_CALL DatabaseDataProvider::isLast() throw( SQLException, RuntimeException, std::exception )
1004 : {
1005 0 : return m_xRowSet->isLast();
1006 : }
1007 :
1008 0 : void SAL_CALL DatabaseDataProvider::beforeFirst() throw( SQLException, RuntimeException, std::exception )
1009 : {
1010 0 : m_xRowSet->beforeFirst();
1011 0 : }
1012 :
1013 0 : void SAL_CALL DatabaseDataProvider::afterLast() throw( SQLException, RuntimeException, std::exception )
1014 : {
1015 0 : m_xRowSet->afterLast();
1016 0 : }
1017 :
1018 0 : sal_Bool SAL_CALL DatabaseDataProvider::first() throw( SQLException, RuntimeException, std::exception )
1019 : {
1020 0 : return m_xRowSet->first();
1021 : }
1022 :
1023 0 : sal_Bool SAL_CALL DatabaseDataProvider::last() throw( SQLException, RuntimeException, std::exception )
1024 : {
1025 0 : return m_xRowSet->last();
1026 : }
1027 :
1028 0 : sal_Int32 SAL_CALL DatabaseDataProvider::getRow() throw( SQLException, RuntimeException, std::exception )
1029 : {
1030 0 : return m_xRowSet->getRow();
1031 : }
1032 :
1033 0 : sal_Bool SAL_CALL DatabaseDataProvider::absolute(sal_Int32 row) throw( SQLException, RuntimeException, std::exception )
1034 : {
1035 0 : return m_xRowSet->absolute(row);
1036 : }
1037 :
1038 0 : sal_Bool SAL_CALL DatabaseDataProvider::relative(sal_Int32 rows) throw( SQLException, RuntimeException, std::exception )
1039 : {
1040 0 : return m_xRowSet->relative(rows);
1041 : }
1042 :
1043 0 : sal_Bool SAL_CALL DatabaseDataProvider::previous() throw( SQLException, RuntimeException, std::exception )
1044 : {
1045 0 : return m_xRowSet->previous();
1046 : }
1047 :
1048 0 : void SAL_CALL DatabaseDataProvider::refreshRow() throw( SQLException, RuntimeException, std::exception )
1049 : {
1050 0 : m_xRowSet->refreshRow();
1051 0 : }
1052 :
1053 0 : sal_Bool SAL_CALL DatabaseDataProvider::rowUpdated() throw( SQLException, RuntimeException, std::exception )
1054 : {
1055 0 : return m_xRowSet->rowUpdated();
1056 : }
1057 :
1058 0 : sal_Bool SAL_CALL DatabaseDataProvider::rowInserted() throw( SQLException, RuntimeException, std::exception )
1059 : {
1060 0 : return m_xRowSet->rowInserted();
1061 : }
1062 :
1063 0 : sal_Bool SAL_CALL DatabaseDataProvider::rowDeleted() throw( SQLException, RuntimeException, std::exception )
1064 : {
1065 0 : return m_xRowSet->rowDeleted();
1066 : }
1067 :
1068 0 : uno::Reference< uno::XInterface > SAL_CALL DatabaseDataProvider::getStatement() throw( SQLException, RuntimeException, std::exception )
1069 : {
1070 0 : return m_xRowSet->getStatement();
1071 : }
1072 :
1073 0 : uno::Reference< uno::XInterface > SAL_CALL DatabaseDataProvider::getParent( ) throw (uno::RuntimeException, std::exception)
1074 : {
1075 0 : return m_xParent;
1076 : }
1077 :
1078 0 : void SAL_CALL DatabaseDataProvider::setParent( const uno::Reference< uno::XInterface >& _xParent ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
1079 : {
1080 0 : osl::MutexGuard g(m_aMutex);
1081 0 : m_xParent = _xParent;
1082 0 : }
1083 :
1084 0 : void DatabaseDataProvider::impl_invalidateParameter_nothrow()
1085 : {
1086 0 : osl::MutexGuard g(m_aMutex);
1087 0 : m_aParameterManager.clearAllParameterInformation();
1088 0 : }
1089 :
1090 : } // namespace dbaccess
1091 :
1092 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|