Skip to content
Permalink
Browse files
Fix: HANA layer is empty when importing from 'memory' VectorLayer
  • Loading branch information
mrylov authored and nyalldawson committed May 17, 2021
1 parent 8e4de4b commit d94b60a3541bf8023266360295adf01618427e64
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/providers/hana/qgshanadataitems.cpp
@@ -152,7 +152,15 @@ bool QgsHanaConnectionItem::handleDrop( const QMimeData *data, const QString &to
}

// open the source layer
QgsVectorLayer *srcLayer = new QgsVectorLayer( u.uri, u.name, u.providerKey );
bool owner;
QString error;
QgsVectorLayer *srcLayer = u.vectorLayer( owner, error );
if ( !srcLayer )
{
importResults.append( tr( "%1: %2" ).arg( u.name, error ) );
hasError = true;
continue;
}

if ( srcLayer->isValid() )
{
@@ -168,8 +176,9 @@ bool QgsHanaConnectionItem::handleDrop( const QMimeData *data, const QString &to
uri.setWkbType( srcLayer->wkbType() );

std::unique_ptr< QgsVectorLayerExporterTask > exportTask(
QgsVectorLayerExporterTask::withLayerOwnership( srcLayer, uri.uri( false ),
QStringLiteral( "hana" ), srcLayer->crs() ) );
new QgsVectorLayerExporterTask( srcLayer, uri.uri( false ),
QStringLiteral( "hana" ), srcLayer->crs(), QVariantMap(), owner ) );

// when export is successful:
connect( exportTask.get(), &QgsVectorLayerExporterTask::exportComplete, this,
[ = ]()

0 comments on commit d94b60a

Please sign in to comment.