I would use the update if I knew the entry already existed. In my application however, it doesn't know if the entry already exists. I was looking for something to replace MySQL's ON DUPLICATE KEY UPDATE.
I modified my application to use two SQL statements instead. if (!db.execute("INSERT INTO users VALUES(?, ?, ?);", user.id, user.type, user.name)) { db.execute("UPDATE users SET name=? WHERE id=? AND type=?;", user.name, user.id, user.type); } I was hoping for a single statement, but oh well. Thanks. --- On Mon, 10/18/10, Igor Tandetnik <itandet...@mvps.org> wrote: From: Igor Tandetnik <itandet...@mvps.org> Subject: Re: [sqlite] Issue using ON DELETE CASCADE along with ON CONFLICTREPLACE To: sqlite-users@sqlite.org Date: Monday, October 18, 2010, 4:36 PM NSRT Mail account. <joecool2...@yahoo.com> wrote: > The entry in meetings is now gone. Should ON DELETE CASCADE be picking up an > UPDATE as a DELETE via INSERT INTO from ON CONFLICT > REPLACE? REPLACE involves deleting conflicting rows, followed by INSERT, as explained by the documentation at http://sqlite.org/lang_conflict.html . No UPDATE is taking place - in general, several rows may be deleted for one row inserted, in which case update would make no sense. > Is there perhaps a better way I should be structuring my tables so I can use > an INSERT or UPDATE style command, yet force DELETEs > to cascade to the other table? What problems do you have with UPDATE? This should work: UPDATE users set name='Joe C' where id=1 and type=4; -- Igor Tandetnik _______________________________________________ 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