Skip to content

Commit

Permalink
msOGRFileOpen(): reset OGR error after trying to run 'SELECT spatiali…
Browse files Browse the repository at this point in the history
…te_version()' for SQlite and GPKG input datasets
  • Loading branch information
rouault committed Mar 6, 2018
1 parent 9297c35 commit 4e4885f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mapogr.cpp
Expand Up @@ -1333,6 +1333,7 @@ msOGRFileOpen(layerObj *layer, const char *connection )
}

CPLPopErrorHandler();
CPLErrorReset();

if (have_spatialite)
psInfo->dialect = "Spatialite";
Expand Down Expand Up @@ -1378,6 +1379,7 @@ msOGRFileOpen(layerObj *layer, const char *connection )
OGR_DS_ReleaseResultSet(hDS, l);
}
CPLPopErrorHandler();
CPLErrorReset();

if( have_gpkg_spatialite )
{
Expand Down

2 comments on commit 4e4885f

@geographika
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rouault - thanks for this, the OGR error is gone, and the image can be successfully created.

Just to note, I built both MapServer and GDAL from source and applied this patch. Interestingly the error is also gone without the above patch when using GDAL master - (2.3.0dev 2017/99/99).
When reverting back to GDAL 2.2.3 (released 2017/11/20) the MapServer OGR error reappears unless the above patch is used. I assume something changed with the CPLPopErrorHandler between 2.2.3 and 2.3.0?

@rouault
Copy link
Contributor Author

@rouault rouault commented on 4e4885f Mar 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume something changed with the CPLPopErrorHandler between 2.2.3 and 2.3.0?

No, but likely in the GPKG driver we call CPLErrorReset() now

Please sign in to comment.