Skip to content

Never mark the DB dirty if it is read-only. Issue #1514 - #1536

Closed
mgrojo wants to merge 1 commit into
masterfrom
no_savepoints_ro_db
Closed

mgrojo wants to merge 1 commit into
masterfrom
no_savepoints_ro_db

Conversation

@mgrojo

@mgrojo mgrojo commented Sep 20, 2018

Copy link
Copy Markdown
Member

Setting save points does not make sense for read-only databases, so
do never set a save-point while executing a user query if the database has
been opened in read-only mode.

If setSavePoint is ever called in read-only mode, a warning is printed and
the save-point is not set.

If ever a read-write query is executed, it would be rejected by SQLite so
there is no risk of immediately committing any change to the DB.

Setting save points does not make sense for read-only databases, so
do never set a save-point while executing a user query if the database has
been opened in read-only mode.

If setSavePoint is ever called in read-only mode, a warning is printed and
the save-point is not set.

If ever a read-write query is executed, it would be rejected by SQLite so
there is no risk of immediately committing any change to the DB.
@MKleusberg

Copy link
Copy Markdown
Member

Hmm, looking at this and at #1543 I'm thinking it might be easier to just not do any checks at all (also because there might be more problematic spots in the future, like we could enable the Edit Table dialog in read-only mode and allow creation of temporary tables via it) and just modify DBBrowserDB::close() to never ask when closing a read-only database. Or am I missing something?

@mgrojo

mgrojo commented Sep 27, 2018

Copy link
Copy Markdown
Member Author

Maybe, but we would also have to address the enabling of the save and revert buttons and maybe other issues. Not sure what approach would be better.

#1543 is also for not raising spurious save/revert buttons, but that one would also apply to read-write databases.

@MKleusberg

Copy link
Copy Markdown
Member

I have just merged this 😄 I don't really remember what I thought about this back then, but let's just try it 😉

@MKleusberg MKleusberg closed this Feb 13, 2020
@MKleusberg
MKleusberg deleted the no_savepoints_ro_db branch February 13, 2020 11:16
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.

2 participants