[fdo-users] How to attach/detach a property from a propertyvalues of IInserCmd

Greg Boone greg.boone at autodesk.com
Mon Jul 9 07:38:32 PDT 2012


Why remove the NULL property? Can't you just mark the insert property as containing a NULL value?

Greg

-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Ray
Sent: Monday, July 09, 2012 10:24 AM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] How to attach/detach a property from a propertyvalues of IInserCmd

I have an insert cmd of a feature class which has about 100 properties. Now I have around 1 million record to populate. If I NEW-ed property and property values for each record, FDO will bump into insufficient memory issue due to fragemented memory but not really insufficient memory.

So I like to use the same insertcmd and propertyvalues and use the dictionary strategy that Jackie Ng recommened.

The question is that some of the records have some NULL property values. So I remove the property from oPropertyValues for the record, then add it back right away. However, after a few thousand records, it starts to give me read/write protected memory error.

The following is simiplified code snippet. Can anyone give me any suggestions? I wonder if the propertyvalues.attach and detach() method can be used for this purpose and how I use them?


oInsertCmd = oFDOConnection.CreateCommand(CommandType.CommandType_Insert)
            oInsertCmd.SetFeatureClassName(fcName)
            oPropertyValues = oInsertCmd.PropertyValues

.............
'Remove property value from oPropertyValues if it has NULL value

If fdoReader.IsNull(propertyName) Then
                        oPropertyValue =
oPropertyValues.GetItem(propertyName)
                        nullProps.Add(propertyName, oPropertyValue)
                        oPropertyValues.Remove(oPropertyValue)
End If

.......................

'Add property value back to oPropertyValues for next record Dim npenum As IEnumerator
                If nullProps.Count > 0 Then
                    npenum = nullProps.Values.GetEnumerator()
                    While npenum.MoveNext
                  If oPropertyValues.Contains(npenum.Current) = False Then
                            oPropertyValues.Add(npenum.Current)
                        End If
                    End While
                End If
   
 nullProps.Clear()

Thanks,
Ray



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-attach-detach-a-property-from-a-propertyvalues-of-IInserCmd-tp4986964.html
Sent from the FDO Users mailing list archive at Nabble.com.
_______________________________________________
fdo-users mailing list
fdo-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-users


More information about the fdo-users mailing list