Tag: cws_src680_rptchart01
User: oj      
Date: 2008-02-21 09:59:26+0000
Modified:
   dba/dbaccess/source/core/misc/DatabaseDataProvider.cxx

Log:
 #i85225# return empty sequence when not bound yet

File Changes:

Directory: /dba/dbaccess/source/core/misc/
==========================================

File [changed]: DatabaseDataProvider.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/DatabaseDataProvider.cxx?r1=1.1.2.4&r2=1.1.2.5
Delta lines:  +17 -9
--------------------
--- DatabaseDataProvider.cxx    2008-02-19 16:40:11+0000        1.1.2.4
+++ DatabaseDataProvider.cxx    2008-02-21 09:59:24+0000        1.1.2.5
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: DatabaseDataProvider.cxx,v $
  *
- *  $Revision: 1.1.2.4 $
+ *  $Revision: 1.1.2.5 $
  *
- *  last change: $Author: oj $ $Date: 2008/02/19 16:40:11 $
+ *  last change: $Author: oj $ $Date: 2008/02/21 09:59:24 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -114,6 +114,7 @@
 // lang::XInitialization:
 void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > 
& aArguments) throw (uno::RuntimeException, uno::Exception)
 {
+    osl::MutexGuard g(m_aMutex);
     const uno::Any* pIter = aArguments.getConstArray();
     const uno::Any* pEnd         = pIter + aArguments.getLength();
     for(;pIter != pEnd;++pIter)
@@ -126,6 +127,7 @@
 // chart2::data::XDataProvider:
 ::sal_Bool SAL_CALL DatabaseDataProvider::createDataSourcePossible(const 
uno::Sequence< beans::PropertyValue > & /*aArguments*/) throw 
(uno::RuntimeException)
 {
+    osl::MutexGuard g(m_aMutex);
     sal_Bool bRet = sal_False;
     if ( m_Command.getLength() != 0 && m_xActiveConnection.is() )
     {
@@ -161,6 +163,9 @@
             OSL_ENSURE(0,"Exception caught!");
         }
     }
+    else // no command set, use Internal data handler
+    {
+    }
 
     return bRet;
 }
@@ -204,7 +209,7 @@
 {}
 void DatabaseDataSource::impl_fill()
 {
-    if ( m_aLabels.empty() )
+    if ( m_aLabels.empty() && m_xRowSet.is() )
     {
         uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY);
         uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY);
@@ -274,14 +279,12 @@
 // 
-----------------------------------------------------------------------------
 uno::Reference< chart2::data::XDataSource > SAL_CALL 
DatabaseDataProvider::createDataSource(const uno::Sequence< 
beans::PropertyValue > & aArguments) throw (uno::RuntimeException, 
lang::IllegalArgumentException)
 {
-    if ( !m_pDataSource )
-    {
-        if ( createDataSourcePossible(aArguments) )
+    osl::MutexGuard g(m_aMutex);
+    if ( !m_pDataSource && createDataSourcePossible(aArguments))
         {
             m_pDataSource = new 
DatabaseDataSource(m_xContext,m_xRowSet,m_RowLimit);
             m_xDataSource = m_pDataSource;
         }
-    }
     return m_xDataSource;
 }
 
@@ -309,6 +312,7 @@
 
 uno::Reference< chart2::data::XDataSequence > SAL_CALL 
DatabaseDataProvider::createDataSequenceByRangeRepresentation(const 
::rtl::OUString & _sRangeRepresentation) throw (uno::RuntimeException, 
lang::IllegalArgumentException)
 {
+    osl::MutexGuard g(m_aMutex);
     uno::Reference< chart2::data::XDataSequence > xRet;
     createDataSource(uno::Sequence< beans::PropertyValue >());
     if ( m_pDataSource )
@@ -325,6 +329,10 @@
         else
             xRet = m_pDataSource->getDataSequence(1);
     }
+    else
+    {
+        
xRet.set(m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart.CachedDataSequence")),m_xContext
 ), uno::UNO_QUERY );
+    }
     return xRet;
 }
 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to