Skip to content
Permalink
Browse files

geopackage : disable WAL explicitely if not enabled

  • Loading branch information
olivierdalang committed May 26, 2020
1 parent 89e2720 commit 096c803431e59dffdc649e9ae3213f0e921cc1d2
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/core/providers/ogr/qgsogrprovider.cpp
@@ -3991,8 +3991,10 @@ GDALDatasetH QgsOgrProviderUtils::GDALOpenWrapper( const char *pszPath, bool bUp
}

QString filePath( QString::fromUtf8( pszPath ) );

bool bIsGpkg = QFileInfo( filePath ).suffix().compare( QLatin1String( "gpkg" ), Qt::CaseInsensitive ) == 0;
bool bIsLocalGpkg = false;
if ( QFileInfo( filePath ).suffix().compare( QLatin1String( "gpkg" ), Qt::CaseInsensitive ) == 0 &&
if ( bIsGpkg &&
IsLocalFile( filePath ) &&
!CPLGetConfigOption( "OGR_SQLITE_JOURNAL", nullptr ) &&
QgsSettings().value( QStringLiteral( "qgis/walForSqlite3" ), true ).toBool() )
@@ -4005,6 +4007,12 @@ GDALDatasetH QgsOgrProviderUtils::GDALOpenWrapper( const char *pszPath, bool bUp
CPLSetThreadLocalConfigOption( "OGR_SQLITE_JOURNAL", "WAL" );
bIsLocalGpkg = true;
}
else if ( bIsGpkg )
{
// If WAL isn't set, we explicitely disable it, as it is persistent and it
// may have been set on a previous connection.
CPLSetThreadLocalConfigOption( "OGR_SQLITE_JOURNAL", "DELETE" );
}

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

0 comments on commit 096c803

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