[fdo-trac] #672: FDO 3.4 SQLite provider can't open FDO 3.5 SQLite
datastore
FDO
trac_fdo at osgeo.org
Tue Jul 27 17:50:44 EDT 2010
#672: FDO 3.4 SQLite provider can't open FDO 3.5 SQLite datastore
-------------------------------+--------------------------------------------
Reporter: ijarm | Owner: traianstanev
Type: defect | Status: new
Priority: minor | Milestone: 3.6.0
Component: SQLite Provider | Version: 3.4.0
Severity: 1 | Keywords:
External_id: |
-------------------------------+--------------------------------------------
FDO 3.4 can't open FDO 3.5 SQLite datastore (see the attached file)
The datastore was created with !UseFdoMetadata=FALSE.
Describe schema and select both throw exception:[[BR]]
"(.\Src\Fdo\Schema\!GeometricPropertyDefinition.cpp: 110) The provided
input is invalid for the current mapping process."
Both FDO versions were built following directions given in
`OpenSourceBuild__README.txt`
The code needed to reproduce the error in FDO 3.4:
{{{
FdoPtr<IConnectionManager> manager =
FdoFeatureAccessManager::GetConnectionManager();
m_LogConn = manager->CreateConnection(L"OSGeo.SQLite");
m_LogConn->SetConnectionString(FdoStringP(L"File=") + m_LogFilePath +
L";");
m_LogConn->Open();
FdoPtr<FdoIDescribeSchema> ds =
(FdoIDescribeSchema*)m_LogConn->CreateCommand(FdoCommandType_DescribeSchema);
FdoPtr<FdoFeatureSchemaCollection> fsc = ds->Execute();//THROWS
EXCEPTION
}}}
The code used to create the datastore in FDO 3.5:
{{{
FdoPtr<IConnectionManager> manager =
FdoFeatureAccessManager::GetConnectionManager();
m_LogConn = manager->CreateConnection(L"OSGeo.SQLite");
FdoPtr<FdoICreateDataStore> pCreateCmd = (FdoICreateDataStore*)
m_LogConn->CreateCommand(FdoCommandType_CreateDataStore);
FdoPtr<FdoIDataStorePropertyDictionary> dictionary =
pCreateCmd->GetDataStoreProperties();
int count;
FdoString **names = dictionary->GetPropertyNames(count);
dictionary->SetProperty( names[0], m_LogFilePath );
dictionary->SetProperty( names[1], L"FALSE" );
pCreateCmd->Execute();
m_LogConn->SetConnectionString(FdoStringP(L"File=") + m_LogFilePath +
L";UseFdoMetadata=FALSE;");
if(m_LogConn->Open() == FdoConnectionState_Open)
{
FdoPtr<FdoIApplySchema> as =
(FdoIApplySchema*)m_LogConn->CreateCommand(FdoCommandType_ApplySchema);
m_LogSchema = FdoFeatureSchema::Create(LOG_SCHEMA, L"event log");
as->SetFeatureSchema(m_LogSchema);
as->Execute();
as =
(FdoIApplySchema*)m_LogConn->CreateCommand(FdoCommandType_ApplySchema);
as->SetFeatureSchema(m_LogSchema);
m_LogClass = FdoFeatureClass::Create(LOG_CLASS, L"event log");
FdoPtr<FdoPropertyDefinitionCollection> pdc =
m_LogClass->GetProperties();
FdoPtr<FdoDataPropertyDefinitionCollection> idc =
m_LogClass->GetIdentityProperties();
//
//all the properties added
//
//... and finally geometric property
FdoPtr<FdoGeometricPropertyDefinition> geometry =
FdoGeometricPropertyDefinition::Create(LOG_PROP_GEOMETRY,L"geometry
value");
geometry->SetGeometryTypes(FdoGeometricType_All);
pdc->Add(geometry);
FdoPtr<FdoClassCollection> cc = m_LogSchema->GetClasses();
cc->Add(m_LogClass);
as->SetFeatureSchema(m_LogSchema);
as->Execute();
}
}}}
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/672>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list