Skip to content
Permalink
Browse files
in import vector layer fix overwrite option and report provider errors
  • Loading branch information
brushtyler committed Apr 15, 2012
1 parent 30fb05a commit f8d5d43280043545c292b7f7536064307eed2150
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/core/qgsvectorlayerimport.cpp
@@ -153,9 +153,14 @@ bool QgsVectorLayerImport::flushBuffer()

if ( !mProvider->addFeatures( mFeatureBuffer ) )
{
mErrorMessage = QObject::tr( "Creation error for features from #%1 to #%2" )
QStringList errors = mProvider->errors();
mProvider->clearErrors();

mErrorMessage = QObject::tr( "Creation error for features from #%1 to #%2. Provider errors was: \n%3" )
.arg( mFeatureBuffer.first().id() )
.arg( mFeatureBuffer.last().id() );
.arg( mFeatureBuffer.last().id() )
.arg( errors.join( "\n" ) );

mError = ErrFeatureWriteFailed;
mErrorCount += mFeatureBuffer.count();

@@ -210,8 +215,10 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
}
}

bool overwrite = options->take( "overwrite" ).toBool();

QgsVectorLayerImport * writer =
new QgsVectorLayerImport( uri, providerKey, fields, layer->wkbType(), outputCRS, false, options );
new QgsVectorLayerImport( uri, providerKey, fields, layer->wkbType(), outputCRS, overwrite, options );

// check whether file creation was successful
ImportError err = writer->hasError();

0 comments on commit f8d5d43

Please sign in to comment.