Refactor OSqlSelect and make dedicated test class for generating queries.