mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-04-29 08:29:17 -05:00
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:
+5
-2
@@ -43,7 +43,7 @@ class DBBrowserDB : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DBBrowserDB () : _db(0), isEncrypted(false), isReadOnly(false) {}
|
||||
explicit DBBrowserDB () : _db(0), isEncrypted(false), isReadOnly(false), dontCheckForStructureUpdates(false) {}
|
||||
virtual ~DBBrowserDB (){}
|
||||
bool open ( const QString & db);
|
||||
bool attach(const QString& filename, QString attach_as = "");
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
bool releaseAllSavepoints();
|
||||
bool revertAll();
|
||||
bool dump(const QString & filename, const QStringList &tablesToDump, bool insertColNames, bool insertNew, bool exportSchema, bool exportData);
|
||||
bool executeSQL ( const QString & statement, bool dirtyDB=true, bool logsql=true);
|
||||
bool executeSQL(QString statement, bool dirtyDB = true, bool logsql = true);
|
||||
bool executeMultiSQL(const QString& statement, bool dirty = true, bool log = false);
|
||||
|
||||
/**
|
||||
@@ -127,6 +127,7 @@ public:
|
||||
signals:
|
||||
void sqlExecuted(QString sql, int msgtype);
|
||||
void dbChanged(bool dirty);
|
||||
void structureUpdated();
|
||||
|
||||
private:
|
||||
QString curDBFilename;
|
||||
@@ -137,6 +138,8 @@ private:
|
||||
bool isReadOnly;
|
||||
|
||||
bool tryEncryptionSettings(const QString& filename, bool* encrypted, CipherDialog*& cipherSettings);
|
||||
|
||||
bool dontCheckForStructureUpdates;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user