[Qgis-developer] Proposed plan to fix issue with concurrent opening of OGR datasources (aka QGIS and MapInfo)

Even Rouault even.rouault at spatialys.com
Tue Mar 22 04:11:00 PDT 2016


Le mardi 22 mars 2016 12:08:07, Even Rouault a écrit :
> Le mardi 22 mars 2016 11:39:07, Hugo Mercier a écrit :
> > On 22/03/2016 11:27, Even Rouault wrote:
> > >>> - go back to read-only mode when the user exists the edition mode
> > >>> (this would need a new method in the QgsVectorDataProvider API to
> > >>> warn about that, since the provider has currently no way of knowing
> > >>> that)
> > >> 
> > >> Thank you for taking care of that.
> > >> 
> > >> Could you elaborate on the last item ? Does it mean adding something
> > >> like beginEdit() / endEdit() on QgsVectorDataProvider ?
> > > 
> > > Yes
> > > 
> > >> Is it an API break
> > > 
> > > API extension I'd say. The default implementation would be {}.
> > > 
> > >> and if not how does it work for existing code that
> > >> does not call begin/end edit ?
> > > 
> > > From what I can see in QgsVectorLayer, you cannot call addFeature(),
> > > addFeatures(), changeAttributeValue(), deleteFeature(),
> > > deleteFeatures(), etc.. if there's no mEditBuffer active. And the only
> > > way to have one active is to call startEditing() before. So unless I'm
> > > missing something, it doesn't look like you can do changes to a
> > > dataset without doing them between startEditing() and
> > > commitChanges()/rollBack()
> > 
> > True.
> > But you can also directly access the provider update methods without
> > edit buffers and without startEditing / commitChanges.
> 
> Good point. I didn't think at that use case of direct access to the
> provider API.
> 
> > ... but after all ... if I understood correctly your intents, for
> > existing codes that use this direct provider access, update functions
> > will reopen the source in write mode and they will always stay in that
> > mode because the endEdit() method will never be called ?
> 
> Yes.
> 
> One possibility would be also to go back to read-only mode with a timer.
> For a write operation, outside of beginEdit() / endEdit(), that lead to
> re-opening in update-mode, after X seconds without write activity, the
> dataset would be re-opened in update mode.

correction: "...would be re-opened in *read-only* mode"


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the Qgis-developer mailing list