sql setting added
some refactor