Separated code for mysql and sqlite3.