Opened 4 years ago

Closed 4 years ago

#5060 closed defect (fixed)

msOGRFileNextShape() not compatible with spatialite views

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.10.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: spatialite
Cc:

Description

Reported as https://github.com/mapserver/mapserver/issues/4636

"""

Tested with MS4W 3.1.0-beta1.zip which was installed from http://dl.maptools.org/dl/ms4w/ms4w_3.1.0-beta1.zip

Only DATA "table" works as data source for a Mapserver layer. Views or SQL selects do not work when defined as DATA "table_view" or DATA "select geometry from table"

A small test database and corresponding mapfile can be downloaded from http://latuviitta.org/documents/MS_6.2.1_Spatialite_issue.zip Spatialite database is of Spatialite 3.0 version and created with Spatialite-gui 1.5.0. GDAL/OGR has no trouble with the database. """

The root cause is that OGRSQLiteViewLayer::GetUnderlyingLayer?() can emit a CPLError when calling OGRSQLiteDataSource::GetLayerByName?(), that will be hidden by CPLPushErrorHandler(CPLQuietErrorHandler) and properly recoverd by OGR. But the error itself isn't reset, so msOGRFileNextShape() detects it in if( CPLGetLastErrorType() == CE_Failure ) just after calling OGR_L_GetNextFeature().

Change History (2)

comment:1 Changed 4 years ago by Even Rouault

Fixed in trunk (r25943) and branches/1.10 (r25944, likely 1.10.1 if 1.10.0RC4 is promoted final)

comment:2 Changed 4 years ago by Even Rouault

Milestone: 1.10.0
Resolution: fixed
Status: newclosed

Will be in 1.10.0 (RC5)

Note: See TracTickets for help on using tickets.