refactor code for eval sql log