On Fri, Oct 28, 2011 at 4:15 AM, Sandro Santilli <[email protected]> wrote: > On Thu, Oct 27, 2011 at 09:46:11AM -0300, Martin Dobias wrote: >> That is because not all data providers use ids in interval [0,N-1]. >> For example, postgres provider uses the column with primary key as ID >> - so the values may be arbitrary. It is better to do a select() >> followed by just one nextFeature(). > > Would it make sense to abstract provider-specific IDs so that the > [0, N-1] range holds for everyone ?
This is actually done within attribute table - we store feature IDs for the range [0,N-1] so that we can later access the feature data by row number. But that comes at an additional price: the layer has to be scanned first in order to obtain the mapping and it has to be updated whenever some changes to the layer are done. What would be the requirements of such provider-specific IDs? What to do when a feature is deleted? If we recreate the mapping, some IDs stored by users would change, leading to problems if the user stores them as references to features. If we keep the original mapping, then it may contain holes and therefore the convenient [0, N-1] range would not be valid. Martin _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
