[QGIS-Developer] OGR: sqlite with subset query, QgsOgrFeatureIterator::fetchFeature with SpatialFilterRect always returns feature with id 0

Even Rouault even.rouault at spatialys.com
Sun Sep 3 14:50:19 PDT 2017


> Ok, so if we only do this for non-select queries, we should be safe?

Yes. I suspect the case where a full SELECT statement is used are rare, and people able to do 
that can tweak the request. It would be unreliable to try modifying it.

> 
> > > Something like this [1] seems to fix the issue, don't know if it's the
> > > 
> > > best way forward though?
> > 
> > I've left a few comments in the commit
> 
> Many thanks. I've pushed a revised version at [1].

I've added a couple suggestions for more robustness, but looks good to me.

> I'm in doubt whether
> it is really worth the hassle to hide the orig_ogr_fid column in the
> fields, together with the firstFieldIsFid it looks like it could make
> things very fragile...

Yes the current logic is rather fragile, so if you don't mind having the field both as FID and a 
regular field, this is indeed simpler.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170903/9692e057/attachment.html>


More information about the QGIS-Developer mailing list