refactoring code for utf8mb4 support on mysql2