Refactor Sql into a class, same api as before

Sql becomes a class.