added small API, edited class.db.mysql, untested with sqlite