DBPersistenceManager: fix a test and an edge case

This patch fixes an error in DBPersistenceManagerTest::
testSaveCallsDuplicatesCallbackAndGetsIdWhenThereAreDuplicatesOnUpdate().
The error was only showing up under SQLite due to a minor
difference in how SQLite and MySQL report rows affected.
Also, DBPersistenceManager was modified to handle that edge case and
refactored a bit along the way, and a new test,
testSaveDoesNotCallDuplicatesCallbackWhenUpdateMakesNoChanges(),
was added to DBPersistenceManagerTest for that case.

Change-Id: I162d2ea4700d50aee3626ce873bc496241442677
Merge "DBPersistenceManager: fix a test and an edge case" into wip/editorcampaigns