[fdo-commits] r197 - trunk/Providers/SDF/Src/Provider
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Jan 29 12:47:33 EST 2007
Author: badreddinekaroui
Date: 2007-01-29 12:47:32 -0500 (Mon, 29 Jan 2007)
New Revision: 197
Modified:
trunk/Providers/SDF/Src/Provider/SdfConnection.cpp
trunk/Providers/SDF/Src/Provider/SdfConnection.h
trunk/Providers/SDF/Src/Provider/SdfConnectionCapabilities.cpp
trunk/Providers/SDF/Src/Provider/SdfIndexedScrollableFeatureReader.cpp
trunk/Providers/SDF/Src/Provider/SdfInsert.cpp
trunk/Providers/SDF/Src/Provider/SdfSimpleFeatureReader.cpp
Log:
Merge the SDF provider changes 181 and 158 from branch 3.2.x to the trunk
Modified: trunk/Providers/SDF/Src/Provider/SdfConnection.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfConnection.cpp 2007-01-26 00:31:36 UTC (rev 196)
+++ trunk/Providers/SDF/Src/Provider/SdfConnection.cpp 2007-01-29 17:47:32 UTC (rev 197)
@@ -678,6 +678,10 @@
//close feature data databases
void SdfConnection::DestroyDatabases()
{
+ // Make sure that all updates are committed in an orderly fashion; one class at a time
+ // an with a proper low level transaction.
+ Flush();
+
//iterate over hashmap and close Data databases here..
//stdext::hash_map<FdoClassDefinition*, DataDb*>::iterator dblist;
stdext::hash_map<void*, void*>::iterator dblist;
@@ -759,39 +763,20 @@
m_hPropertyIndices.clear();
}
-void SdfConnection::ReSyncData()
+
+void SdfConnection::ReSyncData(FdoClassDefinition *clas)
{
- stdext::hash_map<void*, void*>::iterator dblist;
-
- for (dblist = m_hDataDbs.begin(); dblist != m_hDataDbs.end(); dblist++)
- {
- //only synch the ids for every base class
- //child classes share the same db
- FdoPtr<FdoClassDefinition> base = ((FdoClassDefinition*)dblist->first)->GetBaseClass();
- if (base == NULL)
- {
- if (dblist->second != NULL)
- {
- ((DataDb*)dblist->second)->SyncIdPool();
- }
- }
- }
+ DataDb *dataDb = GetDataDb(clas);
+ SdfRTree* rt = GetRTree(clas);
- stdext::hash_map<void*, void*>::iterator treelist;
- for (treelist = m_hRTrees.begin(); treelist != m_hRTrees.end(); treelist++)
- {
- //Need to re-read the root node in case it was updated by a different connection.
- FdoPtr<FdoClassDefinition> base = ((FdoClassDefinition*)treelist->first)->GetBaseClass();
- if (base == NULL)
- {
- if (treelist->second != NULL)
- {
- ((SdfRTree*)treelist->second)->UpdateRootNode();
- }
- }
- }
+ if( dataDb )
+ dataDb->SyncIdPool();
+
+ if( rt )
+ rt->UpdateRootNode();
}
+
void SdfConnection::RegenIndex( FdoClassDefinition *clas, KeyDb* keys, DataDb *dataDb )
{
int ret = SQLiteDB_ERROR;
@@ -874,7 +859,7 @@
// the database since the user is only reading this database.
if( keys && forUpdate && keys->IndexNeedsRegen() )
{
-
+
RegenIndex( clas, keys, dataDb );
keys->Flush();
keys->Regened();
@@ -991,36 +976,7 @@
FdoPtr<FdoClassDefinition> base = ((FdoClassDefinition*)dblist->first)->GetBaseClass();
if (base == NULL)
{
- if (dblist->second != NULL)
- {
- ((DataDb*)dblist->second)->Flush();
- }
+ FlushAll( (FdoClassDefinition*)dblist->first, true );
}
}
-
- stdext::hash_map<void*, void*>::iterator keylist;
- for (keylist = m_hKeyDbs.begin(); keylist != m_hKeyDbs.end(); keylist++)
- {
- FdoPtr<FdoClassDefinition> base = ((FdoClassDefinition*)keylist->first)->GetBaseClass();
- if (base == NULL)
- {
- if (keylist->second != NULL)
- {
- ((KeyDb*)keylist->second)->Flush();
- }
- }
- }
-
- stdext::hash_map<void*, void*>::iterator treelist;
- for (treelist = m_hRTrees.begin(); treelist != m_hRTrees.end(); treelist++)
- {
- FdoPtr<FdoClassDefinition> base = ((FdoClassDefinition*)treelist->first)->GetBaseClass();
- if (base == NULL)
- {
- if (treelist->second != NULL)
- {
- ((SdfRTree*)treelist->second)->Flush();
- }
- }
- }
}
Modified: trunk/Providers/SDF/Src/Provider/SdfConnection.h
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfConnection.h 2007-01-26 00:31:36 UTC (rev 196)
+++ trunk/Providers/SDF/Src/Provider/SdfConnection.h 2007-01-29 17:47:32 UTC (rev 197)
@@ -173,7 +173,7 @@
// Used to re-sync with the data on disk. This is needed if 2 or more connections are writting to the same file
// Before a new connection writes to the file it needs to re-synch with the id pool. Otherwise the ids may overlap
// with the existing ids.
- void ReSyncData();
+ void ReSyncData(FdoClassDefinition *clas);
FdoConnectionState Open( SdfCompareHandler* cmpHandler );
Modified: trunk/Providers/SDF/Src/Provider/SdfConnectionCapabilities.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfConnectionCapabilities.cpp 2007-01-26 00:31:36 UTC (rev 196)
+++ trunk/Providers/SDF/Src/Provider/SdfConnectionCapabilities.cpp 2007-01-29 17:47:32 UTC (rev 197)
@@ -56,7 +56,7 @@
// level of thread safety.
FdoThreadCapability SdfConnectionCapabilities::GetThreadCapability()
{
- return FdoThreadCapability_PerCommandThreaded;
+ return FdoThreadCapability_PerConnectionThreaded;
}
Modified: trunk/Providers/SDF/Src/Provider/SdfIndexedScrollableFeatureReader.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfIndexedScrollableFeatureReader.cpp 2007-01-26 00:31:36 UTC (rev 196)
+++ trunk/Providers/SDF/Src/Provider/SdfIndexedScrollableFeatureReader.cpp 2007-01-29 17:47:32 UTC (rev 197)
@@ -64,6 +64,7 @@
m_dataReader->Reset((unsigned char*)m_currentData->get_data(), m_currentData->get_size());
m_currentFeatureRecno = *(REC_NO*)(m_currentKey->get_data());
+ m_Sourcedata->SetTag((void*)this);
if (!m_stringPropsCache.empty())
{
Modified: trunk/Providers/SDF/Src/Provider/SdfInsert.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfInsert.cpp 2007-01-26 00:31:36 UTC (rev 196)
+++ trunk/Providers/SDF/Src/Provider/SdfInsert.cpp 2007-01-29 17:47:32 UTC (rev 197)
@@ -180,7 +180,7 @@
m_connection->FlushAll( clas, true );
// Re-synch with the on-disk id pool
- m_connection->ReSyncData();
+ m_connection->ReSyncData(clas);
m_NeedSync = false;
}
@@ -271,7 +271,7 @@
rt->Insert(bounds, 0, rtkey);
}
}
- }
+ }
}
}
Modified: trunk/Providers/SDF/Src/Provider/SdfSimpleFeatureReader.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfSimpleFeatureReader.cpp 2007-01-26 00:31:36 UTC (rev 196)
+++ trunk/Providers/SDF/Src/Provider/SdfSimpleFeatureReader.cpp 2007-01-29 17:47:32 UTC (rev 197)
@@ -912,6 +912,7 @@
throw FdoCommandException::Create(NlsMsgGetMain(FDO_NLSID(SDFPROVIDER_10_ERROR_ACCESSING_SDFDB)));
m_dataReader->Reset((unsigned char*)m_currentData->get_data(), m_currentData->get_size());
+ m_dbData->SetTag((void*)this);
//we can skip the filter if the feature class
//doesn't match the query base class
@@ -957,6 +958,7 @@
throw FdoCommandException::Create(NlsMsgGetMain(FDO_NLSID(SDFPROVIDER_10_ERROR_ACCESSING_SDFDB)));
m_dataReader->Reset((unsigned char*)m_currentData->get_data(), m_currentData->get_size());
+ m_dbData->SetTag((void*)this);
//we can skip the filter if the feature class
//doesn't match the query base class
More information about the fdo-commits
mailing list