Opened 14 years ago

Closed 14 years ago

#672 closed defect (fixed)

FDO 3.4 SQLite provider can't open FDO 3.5 SQLite datastore

Reported by: ijarm Owned by: romicadascalescu
Priority: critical Milestone: 3.6.0
Component: SQLite Provider Version: 3.4.0
Severity: 1 Keywords:
Cc: igor@… haris@… simon@… External ID:

Description

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:
"(.\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();
  }

Attachments (1)

test.db (128.0 KB ) - added by ijarm 14 years ago.
SQLite datastore created in FDO 3.5, can't use with FDO 3.4

Download all attachments as: .zip

Change History (6)

by ijarm, 14 years ago

Attachment: test.db added

SQLite datastore created in FDO 3.5, can't use with FDO 3.4

comment:1 by traianstanev, 14 years ago

What happens if you manually set the geometry_dettype column in the geometry_columns table to 0?

Also, did you try creating the database using 3.4 and compare the geometry_columns table between the one created by 3.4 and the one by 3.5?

comment:2 by ijarm, 14 years ago

If I manually set geometry_dettype to 0 the same exception is thrown.

Apart from FDO 3.4 not creating geometry_dettype field, the values in fields are: FDO 3.4: geometry_type=0, coord_dimension=2 FDO 3.5: geometry_type=15, coord_dimension=0

It seems there's a problem with geometry_type value. When I set it to 0, no exception is thrown.

comment:3 by traianstanev, 14 years ago

Priority: minorcritical

It appears the 3.5. provider is writing incorrect values in the geometry_types columns (where "correct" is as defined in RFC 16).

comment:4 by traianstanev, 14 years ago

Owner: changed from traianstanev to romicadascalescu

comment:5 by gregboone, 14 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.