Implemented the hook system for the Database class.

Any class can now register a callback for any hook in the Database class.
Added new DatabaseException class.

Updated README.