C++ (Qt)data_handler
C++ (Qt)void run(std::ostream & logger, const received_data_handler_t & data_handler);
C++ (Qt)proxy.run(std::cout, [&](const std::string & data) { auto query_list = sandbox::get_sql_query(data); for (const auto & query : query_list) out << query << std::endl; });
C++ (Qt)#ifndef SQL_PARSER_H#define SQL_PARSER_H #include <regex>#include <string>#include <list> namespace sandbox { inline std::list<std::string> get_sql_query(const std::string & src){ std::regex query_regex("(SELECT[^;]+;)"); auto query_begin = std::sregex_iterator(src.begin(), src.end(), query_regex); auto query_end = std::sregex_iterator(); std::regex r("\\n"); std::list<std::string> result; for (std::sregex_iterator i = query_begin; i != query_end; ++i) { std::smatch match = *i; result.push_back(std::regex_replace(match.str(), r, " ")); } return result;} } /* namespace sandbox */ #endif // SQL_PARSER_H