Refactoring SQL executor