Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds capability to have an updatable data source via ogr connection #2618

Closed
wants to merge 1 commit into from

Conversation

carolinux
Copy link
Contributor

Not doing it like this gives us a read only data source the next time we try to access it (if for some reason we invalidate the connection - for instance via forceReload )
@m-kuhn

@m-kuhn
Copy link
Member

m-kuhn commented Jan 4, 2016

@manisandro what do you think about this?

@manisandro
Copy link
Member

@carolinux In what scenario is a writeable connection from the connection pool required? If memory serves me right, for all operations which alter the dataset, a spearate OGR handle is opened in read/write mode. The connection pool connections should only be used for read-only operations?

@carolinux
Copy link
Contributor Author

I came across this when using the forceReload capability. There the handle
is invalidated and the new handle is created from this method.

On Mon, Jan 4, 2016 at 12:17 PM, Sandro Mani notifications@github.com
wrote:

@carolinux https://github.com/carolinux In what scenario is a writeable
connection from the connection pool required? If memory serves me right,
for all operations which alter the dataset, a spearate OGR handle is opened
in read/write mode. The connection pool connections should only be used for
read-only operations?


Reply to this email directly or view it on GitHub
#2618 (comment).

@manisandro
Copy link
Member

forceReload invalidates all handles, correct. But where is a handle from the connection pool used for altering the dataset?

@carolinux
Copy link
Contributor Author

I am writing a plugin where I want to write to an OGR layer via QGIS. (But
also the OGR layer underlying source may change on its own hence the need
for forceReload). So if I have forceReload'ed once, then the layer becomes
read-only.

On Mon, Jan 4, 2016 at 12:55 PM, Sandro Mani notifications@github.com
wrote:

forceReload invalidates all handles, correct. But where is a handle from
the connection pool used for altering the dataset?


Reply to this email directly or view it on GitHub
#2618 (comment).

@carolinux
Copy link
Contributor Author

xlsx is an ogr layer type that supports read/write btw

On Mon, Jan 4, 2016 at 12:57 PM, Caroline Alexiou carolinegr@gmail.com
wrote:

I am writing a plugin where I want to write to an OGR layer via QGIS. (But
also the OGR layer underlying source may change on its own hence the need
for forceReload). So if I have forceReload'ed once, then the layer becomes
read-only.

On Mon, Jan 4, 2016 at 12:55 PM, Sandro Mani notifications@github.com
wrote:

forceReload invalidates all handles, correct. But where is a handle from
the connection pool used for altering the dataset?


Reply to this email directly or view it on GitHub
#2618 (comment).

@manisandro
Copy link
Member

This behaviour needs to be investigated. The connections in the connection pool should remain read-only.

@m-kuhn
Copy link
Member

m-kuhn commented Jan 4, 2016

Maybe it's related to calling forceReload on a layer which is currently in edit mode?

@carolinux
Copy link
Contributor Author

Why should they remain read-only?

On Mon, Jan 4, 2016 at 1:01 PM, Matthias Kuhn notifications@github.com
wrote:

Maybe it's related to call forceReload on a layer which is currently in
edit mode?


Reply to this email directly or view it on GitHub
#2618 (comment).

@manisandro
Copy link
Member

Because connections from the connection pool should only be used for read-only operations. Connections for altering the dataset are created separately, and the code around them ensures that the connection pool handles are invalidated when the dataset is altered.

@carolinux
Copy link
Contributor Author

Alright, I misunderstood something. It indeed needs to be investigated how to re-open a datasource in r/w mode, but this PR wouldn't solve this then. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants