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

Hugo Mercier hugo.mercier at oslandia.com
Tue Mar 22 03:39:07 PDT 2016

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()

But you can also directly access the provider update methods without
edit buffers and without startEditing / commitChanges.

... 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 ?

More information about the Qgis-developer mailing list