Skip to content

Commit

Permalink
Try to fix all 'not an error' errors in the Execute SQL tab
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Feb 1, 2017
1 parent 934dd39 commit 4794b0d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ void MainWindow::executeQuery()
sqlWidget->getEditor()->getSelection(&execution_start_line, &execution_start_index, &dummy, &dummy);
}

if (query.trimmed().isEmpty())
if (query.trimmed().isEmpty() || query.trimmed() == ";")
return;

query = query.remove(QRegExp("^\\s*BEGIN TRANSACTION;|COMMIT;\\s*$")).trimmed();
Expand All @@ -905,7 +905,7 @@ void MainWindow::executeQuery()
sqlite3_stmt *vm;
QByteArray utf8Query = query.toUtf8();
const char *tail = utf8Query.data();
int sql3status = 0;
int sql3status = SQLITE_OK;
int tail_length = utf8Query.length();
QString statusMessage;
bool modified = false;
Expand All @@ -924,7 +924,7 @@ void MainWindow::executeQuery()
//Accept multi-line queries, by looping until the tail is empty
QElapsedTimer timer;
timer.start();
do
while( tail && *tail != 0 && (sql3status == SQLITE_OK || sql3status == SQLITE_DONE))
{
// Check whether the DB structure is changed by this statement
QString qtail = QString(tail);
Expand Down Expand Up @@ -992,6 +992,8 @@ void MainWindow::executeQuery()
}
break;
}
case SQLITE_MISUSE:
continue;
default:
statusMessage = QString::fromUtf8((const char*)sqlite3_errmsg(db._db)) +
": " + queryPart;
Expand All @@ -1005,7 +1007,7 @@ void MainWindow::executeQuery()
}

execution_start_index = execution_end_index;
} while( tail && *tail != 0 && (sql3status == SQLITE_OK || sql3status == SQLITE_DONE));
}
sqlWidget->finishExecution(statusMessage);
plotDock->updatePlot(sqlWidget->getModel());

Expand Down

0 comments on commit 4794b0d

Please sign in to comment.