Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Offline editing] Unbreak TestQgsOfflineEditing with GDAL >= 3.4.2
Fixes #48012 Basically, for offline editing, we ask QgsOgrProvider to adopt the behaviour it had before #47098, that is use SQLite3 journal_mode = WAL even in read-only mode. Sorry, this "fix" is horrible, but I couldn't get with something better after many hours of investigation. The root cause seems to be that QgsOfflineEditing creates layers using direct OGR API or sqlite3 API, and also uses QgsOgrProvider which has a GDAL dataset reuse mechanism. And all that does not place nicely at all. Maybe the root root cause is that the OGR GPKG driver establishes the list of layers at its opening, and if creates a new one behind its back, which is prone to happen with the dataset caching metchanism, the GDALDataset::GetLayerByName() method doesn't see the newly created layer. With that in mind, I tried to add calls to QgsOgrProviderUtils::invalidateCachedDatasets() but to no avail. Also QgsOgrProviderUtils::invalidateCachedLastModifiedDate() which is used by QgsOgrProvider::createEmptyLayer(), but to no avail. So basically I don't understand why offline editing worked before with a GPKG backend. I'd say it is pure luck. Note: I also saw that qgsofflineediting.cpp at line 315 calls offlineLayer->dataProvider()->invalidateConnections() but that method is only implemented in the Spatialite provider. I tried to implement it in the OGR one, but to no avail too.
- Loading branch information