use g to handle mysql conn and cursor