Remove the valid flag from the SqliteTableModel class

Remove the valid flag from the SqliteTableModel class and remove its
usage in the Execute SQL tab of the main window. I believe this hasn't
been used for some time now because the main sources of error should
really be noticed before the query is even handed over to the model.
Additionally the valid flag wasn't as realible either anymore because of
the multi-threaded execution of the model queries.
This commit is contained in:
Martin Kleusberg
2017-10-22 18:36:51 +02:00
parent 9fd4ebe0e0
commit b9595b9b7e
3 changed files with 8 additions and 25 deletions

View File

@@ -1081,20 +1081,13 @@ void MainWindow::executeQuery()
case SQLITE_ROW:
{
sqlWidget->getModel()->setQuery(queryPart);
if(sqlWidget->getModel()->valid())
{
// The query takes the last placeholder as it may itself contain the sequence '%' + number
statusMessage = tr("%1 rows returned in %2ms from: %3").arg(
sqlWidget->getModel()->totalRowCount()).arg(timer.elapsed()).arg(queryPart.trimmed());
ui->actionSqlResultsSave->setEnabled(true);
ui->actionSqlResultsSaveAsView->setEnabled(!db.readOnly());
sql3status = SQLITE_OK;
}
else
{
statusMessage = tr("Error executing query: %1").arg(queryPart);
sql3status = SQLITE_ERROR;
}
// The query takes the last placeholder as it may itself contain the sequence '%' + number
statusMessage = tr("%1 rows returned in %2ms from: %3").arg(
sqlWidget->getModel()->totalRowCount()).arg(timer.elapsed()).arg(queryPart.trimmed());
ui->actionSqlResultsSave->setEnabled(true);
ui->actionSqlResultsSaveAsView->setEnabled(!db.readOnly());
sql3status = SQLITE_OK;
}
case SQLITE_DONE:
case SQLITE_OK: