[qtcontacts-sqlite] Verify database integrity at open

Integrity check takes to long to run at startup; use a semaphore
to track whether some other process has already opened the database,
and thus performed the integrity check and any required upgrades.
In practice this means that UI app startup won't need to perform the
check since contactsd will be running first.