From 4a3273b3592e7143e4b0457113ce83ddae928f8b Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Tue, 28 Aug 2018 21:45:43 +0200 Subject: [PATCH] Add some PRAGMA which are only connection persistent to the project file The temp_store, wal_autocheckpoint and synchronous PRAGMAs are only stored for the current database connection but not saved in the database file. So to fully restore the working environment after closing a database, this commit adds these three PRAGMAs to the project file format. See issue #1518. --- src/MainWindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 3b0ed304..ec873cb2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -2413,6 +2413,12 @@ bool MainWindow::loadProject(QString filename, bool readOnly) db.setPragma("foreign_keys", xml.attributes().value("foreign_keys").toString()); if(xml.attributes().hasAttribute("case_sensitive_like")) db.setPragma("case_sensitive_like", xml.attributes().value("case_sensitive_like").toString()); + if(xml.attributes().hasAttribute("temp_store")) + db.setPragma("temp_store", xml.attributes().value("temp_store").toString()); + if(xml.attributes().hasAttribute("wal_autocheckpoint")) + db.setPragma("wal_autocheckpoint", xml.attributes().value("wal_autocheckpoint").toString()); + if(xml.attributes().hasAttribute("synchronous")) + db.setPragma("synchronous", xml.attributes().value("synchronous").toString()); loadPragmas(); } else if(xml.name() == "window") { // Window settings @@ -2633,6 +2639,9 @@ void MainWindow::saveProject() xml.writeAttribute("path", db.currentFile()); xml.writeAttribute("foreign_keys", db.getPragma("foreign_keys")); xml.writeAttribute("case_sensitive_like", db.getPragma("case_sensitive_like")); + xml.writeAttribute("temp_store", db.getPragma("temp_store")); + xml.writeAttribute("wal_autocheckpoint", db.getPragma("wal_autocheckpoint")); + xml.writeAttribute("synchronous", db.getPragma("synchronous")); xml.writeEndElement(); // Window settings