CamelDB: Allow nested transactions

There could happen a deadlock when the code tried to do nested transactions,
which might be observed in the ancient migration from mbox to maildir
for local folders sometimes, not talking that the BEGIN/COMMIT cannot be
nested in SQLite, thus this change allows nested transactions. A similar
deadlock could happen when the caller had a write lock on the database
and requested a read lock, which is covered by this change as well.