I am trying to enable foreign keys using the haskell library HDBC-sqlite3. This library uses a small helper c-function
int sqlite3_open2(const char *filename, finalizeonce **ppo)
which in turn calls sqlite3_open one. In the sqlite documentation, I found a nice sqlite3_db_config function that should include foreign keys. To test this, I quickly added 2 rows to sqlite3_open2 (the last two from the list):
int sqlite3_open2(const char *filename, finalizeonce **ppo) { sqlite3 *ppDb; finalizeonce *newobj; int res, *resFK, resFK1; fprintf(stderr, "DB pointer: %d\n", ppDb); res = sqlite3_open(filename, &ppDb); resFK1 = sqlite3_db_config(ppDb, 1002, 1, resFK); fprintf(stderr, "\nForeign Keys: ON/OFF:%d ERR:%d\n", resFK, resFK1); ...
My surprise was the result: Foreign Keys: ON/OFF:0 ERR:1 .
Can someone give me a hint what am I doing wrong or what will be the correct way to include foreign keys?
source share