Hi Puneet, I don't know if you can intercept a query with a trigger the way you're intending (maybe this is possible in sqlite?), but if I may make a suggestion, get in the habit of starting your every session on a crucial database with a transaction. The moment you login:
sqlite> BEGIN; Take a good hard look at the number of rows affected after every operation, check all the data before you end your session, and then either commit it, or rollback the changes: sqlite> COMMIT; sqlite> ROLLBACK; Hope that helps (Time Machine certainly rocks, yeah?) Cheers, Billy On Fri, Feb 6, 2009 at 8:06 AM, P Kishor <punk.k...@gmail.com> wrote: > I had asked this a while back but I think my query got Warnocked. > > I would like to create a TRIGGER (or a CONSTRAINT) that throws an > error if an UPDATE query is run *without* a WHERE clause. This would > prevent accidentally mucking up the entire database, which, believe > you me, I have done more than once, and have been saved only by the > magic of Time Machine. > > The TRIGGER would allow a full UPDATE of the table only by using some > special syntax in the query... like say, by adding something like > WHERE 0=0; > > > > -- > Puneet Kishor > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Billy Gray wg...@zetetic.net _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users