refactor implementation of scala SQL access API