Implemented the getSql method