[gdal-dev] Getting database is locked error when writing to GeoPackage database.
jkellio2
jon.elliott at hexagon.com
Mon Jun 10 10:19:26 PDT 2019
Just in case anyone was curious. The issue here was in the way I was reading
the result set layer the first time. I only read 1 feature (as that was all
I was interested in). Evidently that leaves the result set in a busy state.
I needed to either read the entire layer, i.e.
OSGeo.OGR.Feature fea = layer.GetNextFeature();
while ( fea != null )
{
s = fea.GetFieldAsString( "name" );
layer.GetNextFeature();
}
Or I needed to reset the layer after reading, i.e.
OSGeo.OGR.Feature fea = layer.GetNextFeature();
if ( fea != null )
{
s = fea.GetFieldAsString( "name" );
}
layer.ResetReading();
Once I did this I was able to write to the database the second time.
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
More information about the gdal-dev
mailing list