Skip to content

Commit 9f8dd44

Browse files
MKleusbergrp-
authored andcommitted
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 sqlitebrowser#38.
1 parent 914d38a commit 9f8dd44

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/MainWindow.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,12 @@ void MainWindow::executeQuery()
659659
if (sql3status == SQLITE_OK){
660660
sql3status = sqlite3_step(vm);
661661
sqlite3_finalize(vm);
662+
663+
// SQLite returns SQLITE_DONE when a valid SELECT statement was executed but returned no results. To run into the branch that updates
664+
// the status message and the table view anyway manipulate the status value here.
665+
if(queryPart.trimmed().startsWith("SELECT", Qt::CaseInsensitive) && sql3status == SQLITE_DONE)
666+
sql3status = SQLITE_ROW;
667+
662668
switch(sql3status)
663669
{
664670
case SQLITE_ROW:

0 commit comments

Comments
 (0)