| 166 | } |
| 167 | |
| 168 | vector<string> SplitQueries(const string &input_query) { |
| 169 | vector<string> queries; |
| 170 | auto tokenized_input = Parser::Tokenize(input_query); |
| 171 | size_t last_split = 0; |
| 172 | |
| 173 | for (const auto &token : tokenized_input) { |
| 174 | if (token.type == SimplifiedTokenType::SIMPLIFIED_TOKEN_OPERATOR && input_query[token.start] == ';') { |
| 175 | string segment = input_query.substr(last_split, token.start - last_split); |
| 176 | StringUtil::Trim(segment); |
| 177 | if (!segment.empty()) { |
| 178 | segment.append(";"); |
| 179 | queries.push_back(std::move(segment)); |
| 180 | } |
| 181 | last_split = token.start + 1; |
| 182 | } |
| 183 | } |
| 184 | string final_segment = input_query.substr(last_split); |
| 185 | StringUtil::Trim(final_segment); |
| 186 | if (!final_segment.empty()) { |
| 187 | queries.push_back(std::move(final_segment)); |
| 188 | } |
| 189 | return queries; |
| 190 | } |
| 191 | |
| 192 | unique_ptr<SQLStatement> Parser::GetStatement(const string &query) { |
| 193 | Transformer transformer(options); |
no test coverage detected