Hi Larry,

I think I had similar problem once. 

Here was the solution I found for it:


http://www.mail-archive.com/sqlite-users@sqlite.org/msg73131.html


HTH,

David Richardson

________________________________
 From: Larry Brasfield <brasfield.la...@gmail.com>
To: SQLite Users mailing list <sqlite-users@sqlite.org> 
Sent: Monday, December 24, 2012 2:20 AM
Subject: [sqlite] PRAGMA foreign_keys = ?, feature request
 
I have a situation here that I expect will apply to others as Microsoft's 
"Entity Framework" is used with System.Data.SQLite .

The framework opens and closes the database, presumably like it treats other DB 
connections.  The schema that it sets up for objects related to each other 
relies on foreign keys.  Unfortunately, foreign key enforcement in SQLite, as 
now specified and implemented, only lasts from the time a PRAGMA is issued to 
turn it on until the connection is closed.  Without some trickery, (or 
modifying System.Data.SQLite from its distributed form), I see no way to hook 
DB opens so that I can get foreign key enforcement turned on when it needs to 
be on.

I recognize that I can compile SQLite myself with foreign key enforcement 
defaulted to on.  I may have to do that, but it would be nicer to be able to 
use System.Data.SQLite as built and distributed by sqlite.org .

Perhaps it would make sense for foreign key enforcement to be made persistent 
if something like
  PRAGMA foreign_keys(1, 'PERSISTENT')
was executed.  This could work to turn enforcement off, which could be useful 
once SQLite begins having it on by default.

If anybody knows how to solve this more easily than suggested above, I would 
appreciate your input.

Thanks,
-- Larry Brasfield
*
*
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to