Reimplement the mysqli/mysql compatibility layer