2012年7月24日星期二

"UPSERT " - Update or Insert in Sqlite

"INSERT OR REPLACE" is NOT equal to "UPDATE IF EXIST ,ELSE INSERT"
Since REPLACE is actually and "delete + create" action, not update.
Users need to insert values for ALL columns.

This thread on StackOverFlow provided a better solution to this issue.

Using UPDATE OR REPLACE together with SELECT and coalesce is an alternative to it.

沒有留言:

發佈留言