Dbagent upsert

These patches adds a feature called upsert (insert or update if exists).
How about using other values except `ID` to confirm values are updated?