Skip to content

Commit 096c803

Browse files
committedMay 26, 2020
geopackage : disable WAL explicitely if not enabled
1 parent 89e2720 commit 096c803

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed
 

‎src/core/providers/ogr/qgsogrprovider.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3991,8 +3991,10 @@ GDALDatasetH QgsOgrProviderUtils::GDALOpenWrapper( const char *pszPath, bool bUp
39913991
}
39923992

39933993
QString filePath( QString::fromUtf8( pszPath ) );
3994+
3995+
bool bIsGpkg = QFileInfo( filePath ).suffix().compare( QLatin1String( "gpkg" ), Qt::CaseInsensitive ) == 0;
39943996
bool bIsLocalGpkg = false;
3995-
if ( QFileInfo( filePath ).suffix().compare( QLatin1String( "gpkg" ), Qt::CaseInsensitive ) == 0 &&
3997+
if ( bIsGpkg &&
39963998
IsLocalFile( filePath ) &&
39973999
!CPLGetConfigOption( "OGR_SQLITE_JOURNAL", nullptr ) &&
39984000
QgsSettings().value( QStringLiteral( "qgis/walForSqlite3" ), true ).toBool() )
@@ -4005,6 +4007,12 @@ GDALDatasetH QgsOgrProviderUtils::GDALOpenWrapper( const char *pszPath, bool bUp
40054007
CPLSetThreadLocalConfigOption( "OGR_SQLITE_JOURNAL", "WAL" );
40064008
bIsLocalGpkg = true;
40074009
}
4010+
else if ( bIsGpkg )
4011+
{
4012+
// If WAL isn't set, we explicitely disable it, as it is persistent and it
4013+
// may have been set on a previous connection.
4014+
CPLSetThreadLocalConfigOption( "OGR_SQLITE_JOURNAL", "DELETE" );
4015+
}
40084016

40094017
bool modify_OGR_GPKG_FOREIGN_KEY_CHECK = !CPLGetConfigOption( "OGR_GPKG_FOREIGN_KEY_CHECK", nullptr );
40104018
if ( modify_OGR_GPKG_FOREIGN_KEY_CHECK )

0 commit comments

Comments
 (0)