enhance sqlite to mysql function