moved all SQL queries into single Database module

You were right, I could still give sensible errors from a Database method, I added one called `query_one`.