Skip to content

Commit 447cd18

Browse files
committedNov 15, 2017
Improve chances for copy elision
1 parent 2b6d1f8 commit 447cd18

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed
 

‎src/core/qgsauxiliarystorage.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -683,20 +683,17 @@ bool QgsAuxiliaryStorage::createTable( const QString &type, const QString &table
683683

684684
spatialite_database_unique_ptr QgsAuxiliaryStorage::createDB( const QString &filename )
685685
{
686-
int rc;
687-
688-
// open/create database
689686
spatialite_database_unique_ptr database;
687+
688+
int rc;
690689
rc = database.open_v2( filename, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr );
691690
if ( rc )
692691
{
693692
debugMsg( QStringLiteral( "sqlite3_open_v2" ), database.get() );
694-
return database;
695693
}
696-
697-
// activating Foreign Key constraints
698-
if ( !exec( QStringLiteral( "PRAGMA foreign_keys = 1" ), database.get() ) )
699-
return database;
694+
else
695+
// activating Foreign Key constraints
696+
exec( QStringLiteral( "PRAGMA foreign_keys = 1" ), database.get() );
700697

701698
return database;
702699
}

0 commit comments

Comments
 (0)
Please sign in to comment.