Implemented upsert feature, specialized implementation in MySQL and
Sqlite.