Refactor check for dialect is mysql or mariadb into a support function