Skip to content
Permalink
Browse files

Avoid recreating spatialite handles

  • Loading branch information
m-kuhn committed Nov 15, 2017
1 parent 124f3df commit 4d20a395f4ac977b67559b4e2442bce629569aeb
@@ -731,7 +731,7 @@ QgsSqliteHandle *QgsSqliteHandle::openDb( const QString &dbPath, bool shared )

QgsDebugMsg( "Connection to the database was successful" );

QgsSqliteHandle *handle = new QgsSqliteHandle( database.release(), dbPath, shared );
QgsSqliteHandle *handle = new QgsSqliteHandle( std::move( database ), dbPath, shared );
if ( shared )
sHandles.insert( dbPath, handle );

@@ -137,12 +137,12 @@ class QgsSqliteHandle
// a class allowing to reuse the same sqlite handle for more layers
//
public:
QgsSqliteHandle( sqlite3 *handle, const QString &dbPath, bool shared )
QgsSqliteHandle( spatialite_database_unique_ptr &&database, const QString &dbPath, bool shared )
: ref( shared ? 1 : -1 )
, mDbPath( dbPath )
, mIsValid( true )
{
mDatabase.reset( handle );
mDatabase = std::move( database );
}

sqlite3 *handle()

0 comments on commit 4d20a39

Please sign in to comment.
You can’t perform that action at this time.