Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/RowLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ void RowLoader::run ()
void RowLoader::process (Task & t)
{
QString sLimitQuery;
if(query.startsWith("PRAGMA", Qt::CaseInsensitive) || query.startsWith("EXPLAIN", Qt::CaseInsensitive))
if(query.startsWith("PRAGMA", Qt::CaseInsensitive) || query.startsWith("EXPLAIN", Qt::CaseInsensitive) ||
// With RETURNING keyword DELETE,INSERT,UPDATE can return rows
// https://www.sqlite.org/lang_returning.html
query.startsWith("DELETE", Qt::CaseInsensitive) || query.startsWith("INSERT", Qt::CaseInsensitive) ||
query.startsWith("UPDATE", Qt::CaseInsensitive))
{
sLimitQuery = query;
} else {
Expand Down
9 changes: 8 additions & 1 deletion src/RunSql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,18 @@ bool RunSql::executeNextStatement()
case SQLITE_ROW:
{
// If we get here, the SQL statement returns some sort of data. So hand it over to the model for display. Don't set the modified flag
// because statements that display data don't change data as well.
// because statements that display data don't change data as well, except if the statement are one of INSERT/UPDATE/DELETE that could
// return datas with the RETURNING keyword.

releaseDbAccess();

lk.lock();

// Set the modified flag to true if the statement was one of INSERT/UPDATE/DELETE triggered by a possible RETURNING keyword.
if (query_part_type == StatementType::InsertStatement || query_part_type == StatementType::UpdateStatement ||
query_part_type == StatementType::DeleteStatement)
modified = true;

may_continue_with_execution = false;

auto time_end = std::chrono::high_resolution_clock::now();
Expand Down