DBs are accessible through transaction

Previous implementation has following drawbacks:
- it required a lot of boilerplate to transfer db into a function as
  it also required sending transaction
- databases had to be created before creating writing transaction as
  in other case they were blocked. It caused db creation to happen
  in the top block and was not documented at all
- db access functions have additional parameter - transaction - which
  didn't allow to create easily accessible indexes

Current approach represents database as a tuple of db handle and
transaction. So database has sense only while parent transaction is
alive. Which makes perfect sense.

Databases are created in transaction itself (if it is writable) so there
is no need to create them before usage.

Also it is a preliminary step for implementing indexing traits to
get/set values, which should make it much more readable.

This commit doesn't provide all the functionality rather starts a
foundation for further work and full elimination of unsafe blocks.