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.
This commit is contained in:
Kohei Yoshida 2011-03-01 00:44:42 -05:00
parent dddc5972da
commit effc42d64e
4 changed files with 12 additions and 2 deletions

View file

@ -170,6 +170,7 @@ public:
void clear();
bool empty() const;
void setCache(ScDPCache* p);
bool hasCache() const;
private:
ScDPCacheTable();

View file

@ -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
{

View file

@ -214,7 +214,9 @@ void ScDatabaseDPData::CreateCacheTable()
if (!aCacheTable.empty())
return;
aCacheTable.setCache(mrImport.CreateCache());
if (!aCacheTable.hasCache())
aCacheTable.setCache(mrImport.CreateCache());
aCacheTable.fillTable();
}

View file

@ -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);
}