(SQLite3x) Use our own busy timeout function in order to
print information about lock contention.
(Binary Simulator) A few minor adjustments
(Binary Simulator) Added LOCK_IMMEDIATE around all database access

It seems that sqlite3 doesn't invoke our busy handler in some
situations. In order to prevent deadlock, if we surround any
database access in an "immediate" transaction then they all must
be inside such a transaction.