diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index 785935e7dc40..226dbb5a9316 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -1319,6 +1319,8 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList &flist ) setRelevantFields( ogrLayer, true, attributeIndexes() ); + const bool inTransaction = startTransaction(); + bool returnvalue = true; for ( QgsFeatureList::iterator it = flist.begin(); it != flist.end(); ++it ) { @@ -1328,6 +1330,11 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList &flist ) } } + if ( inTransaction ) + { + commitTransaction(); + } + if ( !syncToDisc() ) { returnvalue = false; @@ -1818,6 +1825,8 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds &id ) if ( !doInitialActionsForEdition() ) return false; + const bool inTransaction = startTransaction(); + bool returnvalue = true; for ( QgsFeatureIds::const_iterator it = id.begin(); it != id.end(); ++it ) { @@ -1827,6 +1836,11 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds &id ) } } + if ( inTransaction ) + { + commitTransaction(); + } + if ( !syncToDisc() ) { returnvalue = false;