so you are suggesting that I put an INSERT in a C loop checking for a constraint violation failure. if I get one, I use errmsg to get the "column XXXX is not unique" message and extract XXXX. Then, I issue a DELETE to clear out rows that match the value of XXXX. is that correct?
On Jul 6, 2009, at 3:53 AM, Simon Slavin wrote: > (Sorry, hit 'Send' before I meant to.) > > On 6 Jul 2009, at 6:34am, James Gregurich wrote: > >> a question for the sqlite developers. >> >> The inability of "INSERT OR REPLACE" to maintain referential >> integrity >> leaves me with no mechanism to implement a feature in my project that >> I was intending to provide. Are there any plans to add in the >> functionality for "INSERT OR REPLACE" to call delete triggers so that >> referential integrity can be maintained? > > It should not call DELETE triggers since it never deletes. It should > call either INSERT triggers or UPDATE triggers depending on which one > it decides to do. > > In the meantime, you can do the same thing yourself: instead of > calling INSERT OR REPLACE, test to see which one would happen then > call either INSERT or UPDATE. Or do the INSERT, allow it to fail if > it will, then do the UPDATE. The triggers on both of those > combinations will work correctly. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users