Greg, Greg, Greg... /sigh Didn't you discover this six or so months ago? I seem to recall someone saying you had to put a pragma in the query or some such. I still don't use SQLite so I don't really know. But I do remember you bringing this up some time ago.
David "If we can hit that bullseye, the rest of the dominoes will fall like a house of cards... checkmate!" -Zapp Brannigan, Futurama On Wed, Jan 11, 2012 at 14:20, Greg Keogh <g...@mira.net> wrote: > Folks, I’ve been using SQLite for many months now and as I previously said, > it plays nicely with EF4. However I just found out by accident that SQLite > does not enforce foreign key constraints. I didn’t realise until I performed > a bulk load of my database with thousands of incorrect PK and FK values and > it just swallowed the lot and loaded all the garbage I threw at it. > > > > Then I had a look and found this: SQLite Foreign Key Support (see down in > item 2). It says that to enable constraints you have to compile it with a > certain definition and then set a PRAGMA at runtime. Yeah great! I’m not > wasting time compiling the whole damn raw source code and then trying to > figure out how to set a PRAGMA in managed code at runtime (unless someone > already knows how to do this easily). > > > > The reason I didn’t discover this issue for 6 months is because I never > looked. And why didn’t I look? ... I could never have imagined that anyone > in their right mind could create a relation database that does not enforce > FK constraints, but they did. They warn on the web page that they may > reverse the behaviour in the future and enable FK constraints by default. > > > > I will continue using SQLite because I love the zero installation footprint > and in all other respects it seems to be working very well. However, just be > aware of the really slack FK behaviour. > > > > Greg