Skip to content
Permalink
Browse files
ogr provider: shapes that can't RandomWrite can't DeleteFeature either
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11763 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 7, 2009
1 parent 6ef2f34 commit 2cc48aa6a60ddfb1bfef4ccf59bdf91eaa68f8a0
Showing with 12 additions and 9 deletions.
  1. +12 −9 src/providers/ogr/qgsogrprovider.cpp
@@ -1075,20 +1075,23 @@ int QgsOgrProvider::capabilities() const
#endif

// OGR doesn't handle shapefiles without attributes, ie. missing DBFs well, fixes #803
if ( ogrDriverName.startsWith( "ESRI" ) && mAttributeFields.size() == 0 )
if ( ogrDriverName.startsWith( "ESRI" ) )
{
QgsDebugMsg( "OGR doesn't handle shapefile without attributes well, ie. missing DBFs" );
ability &= ~( AddFeatures | DeleteFeatures | ChangeAttributeValues | AddAttributes | DeleteAttributes );
if ( mAttributeFields.size() == 0 )
{
QgsDebugMsg( "OGR doesn't handle shapefile without attributes well, ie. missing DBFs" );
ability &= ~( AddFeatures | DeleteFeatures | ChangeAttributeValues | AddAttributes | DeleteAttributes );
}

if (( ability & ChangeAttributeValues ) == 0 )
{
// on readonly shapes OGR reports that it can delete features although it can't RandomWrite
ability &= ~( AddAttributes | DeleteFeatures );
}
}
}

return ability;

/*
return (QgsVectorDataProvider::AddFeatures
| QgsVectorDataProvider::ChangeAttributeValues
| QgsVectorDataProvider::CreateSpatialIndex);
*/
}


0 comments on commit 2cc48aa

Please sign in to comment.