add function can restore sql result into a txt file