inital code for MySQL, untested