Skip to content

Commit d16226b

Browse files
author
jef
committed
ogr provider: shapes that can't RandomWrite can't DeleteFeature either
git-svn-id: http://svn.osgeo.org/qgis/trunk@11763 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4ed28f3 commit d16226b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/providers/ogr/qgsogrprovider.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,20 +1075,23 @@ int QgsOgrProvider::capabilities() const
10751075
#endif
10761076

10771077
// OGR doesn't handle shapefiles without attributes, ie. missing DBFs well, fixes #803
1078-
if ( ogrDriverName.startsWith( "ESRI" ) && mAttributeFields.size() == 0 )
1078+
if ( ogrDriverName.startsWith( "ESRI" ) )
10791079
{
1080-
QgsDebugMsg( "OGR doesn't handle shapefile without attributes well, ie. missing DBFs" );
1081-
ability &= ~( AddFeatures | DeleteFeatures | ChangeAttributeValues | AddAttributes | DeleteAttributes );
1080+
if ( mAttributeFields.size() == 0 )
1081+
{
1082+
QgsDebugMsg( "OGR doesn't handle shapefile without attributes well, ie. missing DBFs" );
1083+
ability &= ~( AddFeatures | DeleteFeatures | ChangeAttributeValues | AddAttributes | DeleteAttributes );
1084+
}
1085+
1086+
if (( ability & ChangeAttributeValues ) == 0 )
1087+
{
1088+
// on readonly shapes OGR reports that it can delete features although it can't RandomWrite
1089+
ability &= ~( AddAttributes | DeleteFeatures );
1090+
}
10821091
}
10831092
}
10841093

10851094
return ability;
1086-
1087-
/*
1088-
return (QgsVectorDataProvider::AddFeatures
1089-
| QgsVectorDataProvider::ChangeAttributeValues
1090-
| QgsVectorDataProvider::CreateSpatialIndex);
1091-
*/
10921095
}
10931096

10941097

0 commit comments

Comments
 (0)