|
| <prev next> |
Re: [sqlite] Foreign Key constraint checking: msg#00884sqlite-users
On 31 Jul 2009, at 8:25pm, 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. This lack of enforcing actually has worked > to > my advantage as when populating my database I can insert data out of > order. However, after all data has been inserted into the database, > I'd > like to perform some constraint checking to ensure that any FK column > value correctly matches a row that the FK references. Is there any > built-in methods or code snippits I can use for this or will I just > have > to roll my own? Dump the database with the command-line tool. Take a look at the file it produces and move all the INSERT commands to the end. Then use the '.read.' command to create a new database with these commands. Then check to see you have the same number of records in all tables. Not easy to automate, but it's good for a one-off check after a monster import job. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@xxxxxxxxxx http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
|
|
||||||||||||||||||||||||
| News | Mail Home | sitemap | FAQ | advertise |