id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
4073,[Shapelib - PATCH] DBFAddNativeFieldType should flush the active record before updating the file,rouault,warmerdam,"The following snippet leads to junk being written in the first record because it is not flushed to disk before adding the second field. The attached patch fixes this by issuing a DBFFlushRecord() at the beginning of DBFAddNativeFieldType.
{{{
ds = ogr.GetDriverByName('ESRI Shapefile').CreateDataSource('createfield.dbf')
lyr = ds.CreateLayer('createfield')
lyr.CreateField(ogr.FieldDefn('foo', ogr.OFTString))
feat = ogr.Feature(lyr.GetLayerDefn())
feat.SetField(0, 'foo')
lyr.CreateFeature(feat)
lyr.CreateField(ogr.FieldDefn('bar', ogr.OFTString))
feat = ogr.Feature(lyr.GetLayerDefn())
feat.SetField(1, 'bar')
lyr.CreateFeature(feat)
ds = None
}}}
",defect,closed,normal,,OGR_SF,unspecified,normal,fixed,shape CreateField(),