[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 02:52:28 PDT 2016
Hi Even,
On 22/03/2016 10:31, Even Rouault wrote:
> Hi,
>
> I'm considering addressing an issue that mainly involves concurrent use of a
> MapInfo TAB dataset by QGIS and MapInfo, as described in
> https://hub.qgis.org/issues/14378, although the planned fix would be a bit more
> general.
>
> The problem is that when QGIS opens a OGR datasource it tries to open it with
> the update mode of the OGROpen() API, which in turn opens the underlying
> file(s) with a mode (dwDesiredAccess = GENERIC_READ | GENERIC_WRITE and
> dwShareMode =
> FILE_SHARE_READ | FILE_SHARE_WRITE with the Windows CreateFile API()) that is
> incompatible with the mode with which MapInfo tries to open files in read-only
> (dwDesiredAccess = GENERIC_READ and dwShareMode =
> FILE_SHARE_READ). Hence MapInfo cannot open a MapInfo dataset already opened
> by QGIS in update mode.
>
> The solution I'm considering would be to modify the QGIS OGR provider to :
> - try to open the dataset in update mode as currently, but if it is
> successful, go back to re-opening it in read-only mode. (we need to try to
> open in update mode so as to have appropriate capabilities)
> - for operations like addFeatures(), addAttributes(), etc ... that need update
> permissions, check the current open mode, and if not update mode already, re-
> open the OGR datasource in update mode
> - 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 ?
Is it an API break and if not how does it work for existing code that
does not call begin/end edit ?
More information about the Qgis-developer
mailing list