[sqlite] Status of FOREIGN KEY implementation
Some time ago I wrote a small tool which generates triggers to enforce foreign key constraints in SQLite, I see someone else might find use for it, so I figured I should post to the list. You can pick it up at: http://odin.nmxs.com/~cpisto/sqlite_fk.tgz There is a readme included in the tarball, but suffice to say it is a very basic sql parser that knows how to generate triggers from CREATE TABLE blocks. it doesnt understand the full syntax that sqlite supports for column definitions, but if someone needs something extra supported, let me know and I will add it. Since I wrote it for use with sqlite, its released into the public domain like sqlite. Ive included a prebuilt linux x86 binary, and win32 exe in the tarball as well. example usage: cat schema.sql | ./fk
Re: [sqlite] Status of FOREIGN KEY implementation
On Wed, Aug 11, 2004 at 05:09:49PM -0700, Cliff Hudson wrote: > engine in a mobile device. Foreign key constraints are one of the features > I would like to see in any database engine we eventually use. According to > the web site, this feature is not yet implemented, and the mailing list This doesn't answer your question, but you can use triggers to implement things like "on delete cascade", e.g. CREATE TRIGGER recording_disc_id_delete DELETE ON disc BEGIN DELETE FROM recording WHERE disc_id=old.id; END; If you have a lot of tables, you could use a scripting language to generate the triggers based on sqlite metadata. For some metadata PRAGMAs see: http://sqlite.org/lang.html#pragma Dave Cook
[sqlite] Status of FOREIGN KEY implementation
I am investigating the possibility of using SQLite as an embedded database engine in a mobile device. Foreign key constraints are one of the features I would like to see in any database engine we eventually use. According to the web site, this feature is not yet implemented, and the mailing list archive and timeline make almost no reference to it other than that they are parsed. Is this feature currently being worked on? Thanks. Cliff Hudson SDE - Wildseed Ltd. Ph. 425-202-2748 Fax. 425-739-2092 Do not mistake Certainty for Truth.