[Qgis-developer] [Python] QgsFeatureIterator for geometryless PostgreSQL-Layer

Jürgen E. Fischer jef at norbit.de
Tue Apr 23 02:38:18 PDT 2013

Hi Martin,

On Tue, 16. Apr 2013 at 09:32:08 +0200, Martin Dobias wrote:
> > IMHO that's not ok.  If the provider doesn't support multiple iterators,
> > the second on should be rejected - forcing the caller to close the other
> > one first.
> You're right - when thinking about it again, it makes more sense to reject
> new iterator rather than close the previous one with force. It should be
> relatively simple to swap the behavior.

Which only moves the problem upward.   Maybe we should handle setFilterFid
requests like the old featureAtId.

> > As we lost the ability to do featureAtId while iterating a layer, we now
> > have a couple of places, where stuff behaves strange and it's not really
> > obvious that it's causes by a setFilterFid request killing a surrounding
> > iteration.
> In the other thread (about updateFeature()) I have noted that we actually
> never really supported featureAtId while iterating a layer - at least not in
> all providers... AFAIK postgis always used only one cursor. With OGR provider
> that could work - but maybe just for some drivers (e.g. shapefile). If I have
> time I will try to do few tests how qgis 1.8 behaved.

I think the postgres provider had a separate (very short lived) cursor for

> > Rejecting it wouldn't cure that, but at least make is show (ok, that's what
> > the error message does also do that now).  And unless we get the parallel
> > setFilterFid request back, we'll need to identify and rewrite the looping
> > code.
> When porting the code to new API, were there really loops that combined
> nextFeature() with featureAtId() ?

Apparently.  But my porting was more an semi-automatic effort - so didn't
really look closely at all the code.  And I wasn't aware that multiple
iterators were a problem - I thought that was kind of the point of the new api.

But we have a few tickets for that.  Eg. http://hub.qgis.org/issues/7472.  I
tried to link others related tickets there.  There are probably more.  The
submitters usually are not aware, that the problems are related.

I think this is a (real) blocker.


Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de
committ(ed|ing) to Quantum GIS                         IRC: jef on FreeNode                         

norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502

More information about the Qgis-developer mailing list