[fdo-users] Create an FdoFeatureClass?
Jackie Ng
jumpinjackie at gmail.com
Tue Apr 14 11:35:18 EDT 2009
If you execute another FdoIDescribeSchema afterwards does your new class appear?
- Jackie
It came from an FdoIDescribeSchema (on the same provider).
1. get schemas
FdoPtr<FdoIDescribeSchema> describeSchemaCommand = (FdoIDescribeSchema*) (FdoConnectionObject->CreateCommand(FdoCommandType_DescribeSchema));
FdoFeatureSchemaCollection* schemaCollection = describeSchemaCommand->Execute();
2. set schema
mFeatureSchema= schemaCollection->GetItem(name)
3. create class
FdoFeatureClass* newClass = FdoFeatureClass::Create(fdoname,fdoname);
FdoPropertyDefinitionCollection* dataProperties = newClass->GetProperties();
// a number of times:
FdoDataPropertyDefinition* fdpd = FdoDataPropertyDefinition::Create(key,key);
fdpd->SetDataType(type);
fdpd->SetReadOnly(false);
dataProperties->Add(fdpd);
//
4. add class
FdoClassCollection* collection = mFeatureSchema->GetClasses();
collection->Add(newClass);
FdoSchemaElementState state = mFeatureSchema->GetElementState(); // shows modified!
mFeatureSchema->AcceptChanges(); // should not be necessary according to documentation
// test
FdoClassCollection* collection = mFeatureSchema->GetClasses(); // shows one more class!
5. apply
FdoPtr<FdoIApplySchema> applySchema;
applySchema = (FdoIApplySchema*) (FdoConnectionObject->CreateCommand(FdoCommandType_ApplySchema));
applySchema->SetFeatureSchema(mFeatureSchema);
applySchema->Execute();
No execptions are thrown, but my database stays the same. I would have expected a new table to show up.
--
View this message in context: http://n2.nabble.com/Create-an-FdoFeatureClass--tp2611536p2633801.html
Sent from the FDO Users mailing list archive at Nabble.com.
More information about the fdo-users
mailing list