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.
This commit is contained in:
Martin Kleusberg
2014-02-07 20:14:17 +01:00
parent d24ab33f2c
commit 6ab8cf3dd3

View File

@@ -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: