From 6ab8cf3dd3d885f2acf302fe4387dfe78d576e60 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Fri, 7 Feb 2014 20:14:17 +0100 Subject: [PATCH] MainWindow: Update execute query table view when no results returned Also update the table view widget and the status message in the Execute Query tab of the main window when the query was valid but returned no results. Fixes #38. --- src/MainWindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 545fdfb7..f93b06f0 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -647,6 +647,12 @@ void MainWindow::executeQuery() if (sql3status == SQLITE_OK){ sql3status = sqlite3_step(vm); sqlite3_finalize(vm); + + // SQLite returns SQLITE_DONE when a valid SELECT statement was executed but returned no results. To run into the branch that updates + // the status message and the table view anyway manipulate the status value here. + if(queryPart.trimmed().startsWith("SELECT", Qt::CaseInsensitive) && sql3status == SQLITE_DONE) + sql3status = SQLITE_ROW; + switch(sql3status) { case SQLITE_ROW: