Dbagent upsert

These patches adds a feature called upsert (insert or update if exists).
Thank you for the suggestion. I added that confirmation.