Also set foreign key preferences when creating a new database

When opening a database we set the foreign key constraint checking
according to the preferences set in the Preferences Dialog. But when
creating a new database this wasn't done accordingly which means the
behaviour of the application is different depending on wether a database
was opened or newly created. This is changed by this commit.
This commit is contained in:
Martin Kleusberg
2015-06-21 22:23:54 +02:00
parent 0387999403
commit 212116ae18

View File

@@ -321,6 +321,12 @@ bool DBBrowserDB::create ( const QString & db)
if (_db)
{
// set preference defaults
QSettings settings(QApplication::organizationName(), QApplication::organizationName());
settings.sync();
bool foreignkeys = settings.value( "/db/foreignkeys", false ).toBool();
setPragma("foreign_keys", foreignkeys ? "1" : "0");
// Enable extension loading
sqlite3_enable_load_extension(_db, 1);