New function db_replace_all