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.