From c636a505c8fa4a3d5199af6e0e37c3493833920f Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Fri, 11 Aug 2017 18:17:55 +0200 Subject: [PATCH] Allow VACUUM command in Execute SQL tab This allows the user to execute VACUUM commands in the Execute SQL by detecting them and not creating a transaction for them. See issue #1021. --- src/MainWindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b695eeba..36bc92d2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -973,8 +973,8 @@ void MainWindow::executeQuery() qtail.startsWith("ROLLBACK", Qt::CaseInsensitive))) structure_updated = true; - // Check whether this is trying to set a pragma - if(qtail.startsWith("PRAGMA", Qt::CaseInsensitive) && qtail.contains('=')) + // Check whether this is trying to set a pragma or to vacuum the database + if((qtail.startsWith("PRAGMA", Qt::CaseInsensitive) && qtail.contains('=')) || qtail.startsWith("VACUUM", Qt::CaseInsensitive)) { // We're trying to set a pragma. If the database has been modified it needs to be committed first. We'll need to ask the // user about that @@ -982,7 +982,7 @@ void MainWindow::executeQuery() { if(QMessageBox::question(this, QApplication::applicationName(), - tr("Setting PRAGMA values will commit your current transaction.\nAre you sure?"), + tr("Setting PRAGMA values or vacuuming will commit your current transaction.\nAre you sure?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape) == QMessageBox::Yes) { @@ -995,7 +995,7 @@ void MainWindow::executeQuery() } } } else { - // We're not trying to set a pragma. In this case make sure a savepoint has been created in order to avoid committing + // We're not trying to set a pragma or to vacuum the database. In this case make sure a savepoint has been created in order to avoid committing // all changes to the database immediately. Don't set more than one savepoint. if(!savepoint_created)