[fdo-users] How to attach/detach a property from a propertyvalues of IInserCmd
Ray
ray.wu at efacec.com
Mon Jul 9 07:23:39 PDT 2012
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.
More information about the fdo-users
mailing list