mysql adapter refactoring