[Mysql] Code refactor & in-memory unittest with H2