logo       

Re: [sqlite] Foreign Key constraint checking: msg#00883

sqlite-users

Subject: Re: [sqlite] Foreign Key constraint checking

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shaun Seckman (Firaxis) wrote:
> I am well aware that SQLite doesn't enforce FK's and that a way around
> this is to use triggers.

Hopefully you are also aware of the genfkey functionality in the shell which
lets you automate generation of those triggers :-)

> Is there any
> built-in methods or code snippits I can use for this or will I just have
> to roll my own?

The triggers are only going to affect new additions/deletions/changes. My
best guess as to getting it to check existing data is to just set a column
value to itself, which will work until the SQLite optimiser figures out what
is happening. Something like:

UPDATE table SET column=column

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpzUQQACgkQmOOfHg372QRoWgCcD6jHw9VNNoRRiJHs/AZh8e8y
in8An0vHcGyyhd33xUWof0aTHNPwz4dF
=XYyE
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@xxxxxxxxxx
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Google Custom Search

News | Mail Home | sitemap | FAQ | advertise