Locking and other libtracker-data fixes
A few fixes for things found fixing ninja test
failures on an unrelated tracker-miners WIP branch:
- Fix situations that we may get "database is locked" with in-memory databases.
- Fix some umcommon situations that we cross reference bad ROWIDs in the database
- Fix for some strange conditions that we might miss solutions in a INSERT/DELETE/WHERE query interspersed in a TrackerBatch