Skip to content
Permalink
Browse files
Set uri directly from provider connection object
  • Loading branch information
pblottiere committed Sep 8, 2021
1 parent 9a3f633 commit ac1c9837292f0f28e04dfe1aff800812ed1a0175
Showing with 1 addition and 4 deletions.
  1. +1 −4 src/core/providers/ogr/qgsogrproviderutils.cpp
@@ -2531,12 +2531,9 @@ bool QgsOgrProviderUtils::saveConnection( const QString &path, const QString &og
}
if ( ok && ! connName.isEmpty() )
{
const QString connection = QStringLiteral( "providers/ogr/%1/connections" ).arg( ogrDriverName );
QgsSettings settings;
settings.setValue( QStringLiteral( "%1/%2/path" ).arg( connection, connName ), path );

QgsProviderMetadata *providerMetadata = QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "ogr" ) );
QgsGeoPackageProviderConnection *providerConnection = static_cast<QgsGeoPackageProviderConnection *>( providerMetadata->createConnection( connName ) );
providerConnection->setUri( path );
providerMetadata->saveConnection( providerConnection, connName );
return true;
}

0 comments on commit ac1c983

Please sign in to comment.