[gdal-dev] SQLite write and read only access modes

Even Rouault even.rouault at mines-paris.org
Fri Sep 13 11:22:14 PDT 2013


Le vendredi 13 septembre 2013 13:36:17, Jukka Rahkonen a écrit :
> Hi,
> 
> I was reading a new message from Sandro Furieri
> https://groups.google.com/d/msg/spatialite-users/Eq2BXc8Bw2I/69Mu2Dxl5qsJ
> and it made me think if GDAL is already doing what is suggested:
> 
> "writer" process is strictly required to execute the
> following PRAGMA before starting any write operation:
> PRAGMA journal_mode=WAL;"

OGR doesn't do it automatically (WAL is new to SQLite 3.7 while OGR still 
supports 3.6 and using WAL can make databases unreadable by SQLite 3.6). 
Provided you have SQLite 3.7 or above, you can however specify --config 
OGR_SQLITE_JOURNAL WAL if you modify the database with ogrinfo / ogr2ogr. This 
is an undocumented feature that was introduced for reasons I don't remember 
during 1.10 development (probably just experimenting). Otherwise in trunk, 
there's a more general option, OGR_SQLITE_PRAGMA that can be used to specify 
any valid pragma, so that would be --config OGR_SQLITE_PRAGMA "journal_mode = 
WAL" 

Note: I've never tried concurrent read-only and read-write accesses with 
SQLite, and it seems to be a very advanced and dangerous game that requires 
good intimacy with SQLite documentation... See 
http://www.sqlite.org/draft/wal.html

> 
> If this is the case then I think that applications like Mapserver could be
> made to create READ-ONLY connection to SQLite/Spatialite db. That would
> make it possible to keep Mapserver running while doing some db maintaining
> with GDAL. That might be useful sometimes and I do not see how it would
> make any harm ever.
> 
> -Jukka Rahkonen-
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list