[fdo-users] How to remove a property definition from a feature class

Brent Robinson brent.robinson at autodesk.com
Tue Jul 17 13:56:15 PDT 2012

Hi Ray,

If you call:


instead of: 


then it should try to drop the column for the property on ApplySchema. Remove() will take the property out if the collection and then ApplySchema won't see it. Delete() will 
mark it for deletion.

There are a few restrictions:
     - the property cannot have values. If the property is nullable then its values for all features must be null before it can be removed. If not-null then the class must have no
       features in order for the removed to be successful. 
    - if it is an identity property, you might also need to remove it from the identity property list before dropping.

However, if the property fails to delete, the reason will be in one of the exceptions in the chain thrown by ApplySchema. The exception thrown will be a general message so you'd need to follow down the inner exceptions to get the error details.


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Ray
Sent: Tuesday, July 17, 2012 3:18 PM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] How to remove a property definition from a feature class

I created a feature class using FDO in Oracle. It is like a table in Oracle.
Now I want to drop a column from the table. How can I do it using FDO?

Here is the code snippet I used to remove the column, but it doesn't work.

''' Describe schema
oCommand =
oDescribeSchema = CType(oCommand, OSGeo.FDO.Commands.Schema.IDescribeSchema)
 oFeatureSchemaCollection = oDescribeSchema.Execute()

''Get the feature schema and feature class
       For i = 0 To oFeatureSchemaCollection.Count() - 1

                oFeatureSchema = oFeatureSchemaCollection.Item(i)
                oSchemaClassCollection = oFeatureSchema.Classes()

                Dim oClasses As OSGeo.FDO.Schema.ClassCollection =
                 oFeatureClass = oSchemaClassCollection.Item(j)

''Remove property definiction from the feature class
   oPropertyDefinitionCollection = oFeatureClass.Properties()

                For Each oPropertyDefinition In oPropertyDefinitionCollection
            If oPropertyDefinition.Name.ToUpper = sPropertyName.ToUpper Then

 ''Save the schema
        Dim oCommand As OSGeo.FDO.Commands.ICommand
        Dim oApplySchemaCmd As OSGeo.FDO.Commands.Schema.IApplySchema
        oCommand = oFDOConnection.CreateCommand
        oApplySchemaCmd = CType(oCommand,
        oApplySchemaCmd.FeatureSchema = oFeatureSchema

View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-remove-a-property-definition-from-a-feature-class-tp4988878.html
Sent from the FDO Users mailing list archive at Nabble.com.
fdo-users mailing list
fdo-users at lists.osgeo.org

More information about the fdo-users mailing list