Port database class from Namecoin

Port the "db-updater" change from Namecoin.  This introduces a wrapper class around CTxDB and CNameDB, prevents frequent closing of CNameDB's with BDB checkpointing and paves the way for future UTXO optimisations.