Use Sql object instead of raw Sql\* objects to build queries.

Add missing DocBlocks.