Database: clean up lockTables() and add postgres support
A new method is now available to check whether session scope
locks are supported, which callers typically want when using lock().
Its usage can avoid deadlock prone and expensive row-level locks for
some maintenance tasks.
For Postgres, table locks are tied to the transaction. Trigger
startAtomic() in lockTables() and endAtomic() in unlockTables() to
assure that a transaction is present.
Also remove LOW_PRIORITY feature, which is ignored by mysql.
Change-Id: I499061bcc2763afb1ff4a43319064eed4ba3a8fe