Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset SQL results table when the query has not returned data #1437

Merged
merged 1 commit into from Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/MainWindow.cpp
Expand Up @@ -1188,6 +1188,8 @@ void MainWindow::executeQuery()
// If we get here, the SQL statement doesn't return data and just executes. Don't run it again because it has already been executed.
// But do set the modified flag because statements that don't return data, often modify the database.

sqlWidget->getModel()->reset();

QString stmtHasChangedDatabase;
if(query_part_type == InsertStatement || query_part_type == UpdateStatement || query_part_type == DeleteStatement)
stmtHasChangedDatabase = tr(", %1 rows affected").arg(sqlite3_changes(pDb.get()));
Expand Down
3 changes: 3 additions & 0 deletions src/sqlitetablemodel.cpp
Expand Up @@ -95,6 +95,7 @@ void SqliteTableModel::handleRowCountComplete (int life_id, int num_rows)

void SqliteTableModel::reset()
{
beginResetModel();
clearCache();

m_sTable.clear();
Expand All @@ -106,6 +107,8 @@ void SqliteTableModel::reset()
m_vDataTypes.clear();
m_vDisplayFormat.clear();
m_pseudoPk.clear();

endResetModel();
}

void SqliteTableModel::setChunkSize(size_t chunksize)
Expand Down