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.
This commit is contained in:
Martin Kleusberg
2018-05-16 16:18:03 +02:00
parent c25ce1399a
commit aebfc5151e

View File

@@ -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