[Libreoffice-commits] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Feb 28 21:46:36 PST 2011


 sc/inc/dpcachetable.hxx              |    1 +
 sc/source/core/data/dpcachetable.cxx |    5 +++++
 sc/source/core/data/dpsdbtab.cxx     |    4 +++-
 sc/source/core/data/dpshttab.cxx     |    4 +++-
 4 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 1b02e4c65095b7bc28d179107ea9975a64b1b085
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Mar 1 00:44:42 2011 -0500

    Check for existance of cache before creating a new one.
    
    Sometimes a cache is passed onto the cache table at construction
    time, in which case the cache is already there by the time
    CreateCacheTable() is called.  We need to check that.

diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index b8ae177..d9f607f 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -170,6 +170,7 @@ public:
     void clear();
     bool empty() const;
     void setCache(ScDPCache* p);
+    bool hasCache() const;
 
 private:
     ScDPCacheTable();
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 53227eb..2d8b955 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -417,6 +417,11 @@ void ScDPCacheTable::setCache(ScDPCache* p)
     mpCache = p;
 }
 
+bool ScDPCacheTable::hasCache() const
+{
+    return mpCache != NULL;
+}
+
 bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria,
                                     const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const
 {
diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx
index 1b8915a..fbe6fe4 100644
--- a/sc/source/core/data/dpsdbtab.cxx
+++ b/sc/source/core/data/dpsdbtab.cxx
@@ -214,7 +214,9 @@ void ScDatabaseDPData::CreateCacheTable()
     if (!aCacheTable.empty())
         return;
 
-    aCacheTable.setCache(mrImport.CreateCache());
+    if (!aCacheTable.hasCache())
+        aCacheTable.setCache(mrImport.CreateCache());
+
     aCacheTable.fillTable();
 }
 
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index cbc19f6..797d5a5 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -201,7 +201,9 @@ void ScSheetDPData::CreateCacheTable()
         // already cached.
         return;
 
-    aCacheTable.setCache(mrDesc.CreateCache());
+    if (!aCacheTable.hasCache())
+        aCacheTable.setCache(mrDesc.CreateCache());
+
     aCacheTable.fillTable(aQuery, pSpecial, bIgnoreEmptyRows, bRepeatIfEmpty);
 }
 


More information about the Libreoffice-commits mailing list