File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,11 @@ void RowLoader::run ()
203203void RowLoader::process (Task & t)
204204{
205205 QString sLimitQuery ;
206- if (query.startsWith (" PRAGMA" , Qt::CaseInsensitive) || query.startsWith (" EXPLAIN" , Qt::CaseInsensitive))
206+ if (query.startsWith (" PRAGMA" , Qt::CaseInsensitive) || query.startsWith (" EXPLAIN" , Qt::CaseInsensitive) ||
207+ // With RETURNING keyword DELETE,INSERT,UPDATE can return rows
208+ // https://www.sqlite.org/lang_returning.html
209+ query.startsWith (" DELETE" , Qt::CaseInsensitive) || query.startsWith (" INSERT" , Qt::CaseInsensitive) ||
210+ query.startsWith (" UPDATE" , Qt::CaseInsensitive))
207211 {
208212 sLimitQuery = query;
209213 } else {
Original file line number Diff line number Diff line change @@ -182,11 +182,17 @@ bool RunSql::executeNextStatement()
182182 case SQLITE_ROW:
183183 {
184184 // 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
185- // because statements that display data don't change data as well.
185+ // because statements that display data don't change data as well, except if the statement are one of INSERT/UPDATE/DELETE that could
186+ // return datas with the RETURNING keyword.
186187
187188 releaseDbAccess ();
188189
189190 lk.lock ();
191+
192+ // Set the modified flag to true if the statement was one of INSERT/UPDATE/DELETE triggered by a possible RETURNING keyword.
193+ if (query_type == InsertStatement || query_type == UpdateStatement || query_type == DeleteStatement)
194+ modified = true ;
195+
190196 may_continue_with_execution = false ;
191197
192198 auto time_end = std::chrono::high_resolution_clock::now ();
You can’t perform that action at this time.
0 commit comments