Added context manager for Database class.
Tidied up some API loose ends.
Support for SIGPIPE and improved printing.