mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Don't ask for saving changes when importing a SQL file
When importing a SQL file into a new database, we would create a database file, import everything, then close the database and open it in the GUI. While closing, however, the application asks you whether you want to save the changes you made which can be confusing. This is solved by creating an empty database, then closing it immediately without any changes just to then open it in the GUI. Only then the import takes place. See comment in issue #1045.
This commit is contained in:
@@ -1734,7 +1734,10 @@ void MainWindow::importDatabaseFromSQL()
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the new file and open it in the browser
|
||||
db.create(newDbFile);
|
||||
db.close();
|
||||
fileOpen(newDbFile);
|
||||
}
|
||||
|
||||
// Defer foreign keys. Just deferring them instead of disabling them should work fine because in the import we only expect CREATE and INSERT
|
||||
@@ -1760,14 +1763,9 @@ void MainWindow::importDatabaseFromSQL()
|
||||
// Restore the former foreign key settings
|
||||
db.setPragma("defer_foreign_keys", foreignKeysOldSettings);
|
||||
|
||||
// Refresh window when importing into an existing DB or - when creating a new file - just open it correctly
|
||||
if(newDbFile.size())
|
||||
{
|
||||
fileOpen(newDbFile);
|
||||
} else {
|
||||
db.updateSchema();
|
||||
populateTable();
|
||||
}
|
||||
// Refresh views
|
||||
db.updateSchema();
|
||||
populateTable();
|
||||
}
|
||||
|
||||
void MainWindow::openPreferences()
|
||||
|
||||
Reference in New Issue
Block a user