refactor mysql.js

So far dried up the single query functions, transactions are still todo