refactoring of parseSqlAll