Preliminary refactors.

* Fix imports.
* Make lock and logger private attributes.
Setup a context manager for queries.

* Move type registration at initializer.
* Factor a `login` function out of `_connectToDb`.
* Guarantee lock is acquired and released.
* Guarantee connection is opened and closed.
* Silence pylint errors; the decorator is not meant to be used as an
  instance method.
Execute queries inside the context manager.
Drop old connect/disconnect utilities.
Fix and elaborate docstrings.

* Also have the Connection commit after each operation.
Merge pull request #1023 from Renelvon/refactor_db_store

Refactor db_store using context managers