Enable foreign keys by default when opening the database
This commit is contained in:
@@ -14473,6 +14473,13 @@ int cweb_enable_database(CWEB *cweb, CWEB_String database_file, CWEB_String sche
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = sqlite3_exec(cweb->db, "PRAGMA foreign_keys = ON;", NULL, NULL, NULL);
|
||||
if (ret != SQLITE_OK) {
|
||||
sqlite3_close(cweb->db);
|
||||
cweb->db = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
LoadedFile *schema = load_file(schema_file);
|
||||
if (schema == NULL) {
|
||||
sqlite3_close(cweb->db);
|
||||
|
||||
@@ -1061,6 +1061,13 @@ int cweb_enable_database(CWEB *cweb, CWEB_String database_file, CWEB_String sche
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = sqlite3_exec(cweb->db, "PRAGMA foreign_keys = ON;", NULL, NULL, NULL);
|
||||
if (ret != SQLITE_OK) {
|
||||
sqlite3_close(cweb->db);
|
||||
cweb->db = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
LoadedFile *schema = load_file(schema_file);
|
||||
if (schema == NULL) {
|
||||
sqlite3_close(cweb->db);
|
||||
|
||||
Reference in New Issue
Block a user