Only reload DB schema when necessary

We used to reload the database schema whenever it might have been
changed and the latest version was required. For example: when the user
switches to the Structure tab we need the current schema; so we just
reloaded it to be safe - it might have been changed in the Execute SQL
tab or wherever.

With this commit we don't reload the database schema anymore when an
up-to-date version is needed but instead when it was changed by the
application. So in the example above it's not reloaded at all anymore.
Only if and when the user would execute some structure changing SQL it
would be reloaded.

Benefits:
- Better performance
- State of the structure tree view isn't lost as frequently
- Structure tree view gets updated when changing the structure in the
  Execute SQL tab

Downsides:
- Less error proof (testing!)
- No 'automatic' updates when the db is changed by an external
  application.

Any suggestions welcome!
This commit is contained in:
Martin Kleusberg
2016-08-30 00:29:50 +02:00
parent 8a9130883b
commit 684958b29c
5 changed files with 70 additions and 34 deletions

View File

@@ -166,7 +166,6 @@ void EditTableDialog::reject()
{
// Then rollback to our savepoint
pdb->revertToSavepoint(m_sRestorePointName);
pdb->updateSchema();
QDialog::reject();
}