Skip to content

Commit

Permalink
Add fast truncate implementation for memory provider
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 27, 2018
1 parent b0aae0b commit fd0fba7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/providers/memory/qgsmemoryprovider.cpp
Expand Up @@ -616,9 +616,16 @@ QgsVectorDataProvider::Capabilities QgsMemoryProvider::capabilities() const
{
return AddFeatures | DeleteFeatures | ChangeGeometries |
ChangeAttributeValues | AddAttributes | DeleteAttributes | RenameAttributes | CreateSpatialIndex |
SelectAtId | CircularGeometries;
SelectAtId | CircularGeometries | FastTruncate;
}

bool QgsMemoryProvider::truncate()
{
mFeatures.clear();
clearMinMaxCache();
mExtent.setMinimal();
return true;
}

void QgsMemoryProvider::updateExtents()
{
Expand Down
1 change: 1 addition & 0 deletions src/core/providers/memory/qgsmemoryprovider.h
Expand Up @@ -68,6 +68,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
bool supportsSubsetString() const override { return true; }
bool createSpatialIndex() override;
QgsVectorDataProvider::Capabilities capabilities() const override;
bool truncate() override;

/* Implementation of functions from QgsDataProvider */

Expand Down

0 comments on commit fd0fba7

Please sign in to comment.