Permalink
Browse files

No need to commit when setting defer_foreign_keys pragma

Don't commit the current transaction when setting the defer_foreign_keys
pragma in the Execute SQL tab. Not only isn't it required by SQLite but
it's quite contrary to the point of a pragma the purpose of which is
to change the current transaction.
  • Loading branch information...
MKleusberg committed May 16, 2018
1 parent c25ce13 commit aebfc5151ec1c2e0cb2c5a01a81a4e53f682f7c7
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/MainWindow.cpp
@@ -1060,7 +1060,7 @@ void MainWindow::executeQuery()
structure_updated = true;

// Check whether this is trying to set a pragma or to vacuum the database
if((query_type == PragmaStatement && qtail.contains('=')) || query_type == VacuumStatement)
if((query_type == PragmaStatement && qtail.contains('=') && !qtail.contains("defer_foreign_keys", Qt::CaseInsensitive)) || query_type == VacuumStatement)
{
// We're trying to set a pragma. If the database has been modified it needs to be committed first. We'll need to ask the
// user about that

0 comments on commit aebfc51

Please sign in to comment.