MCPcopy Create free account
hub / github.com/duckdb/duckdb / SplitQueries

Function SplitQueries

src/parser/parser.cpp:168–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168vector<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
192unique_ptr<SQLStatement> Parser::GetStatement(const string &query) {
193 Transformer transformer(options);

Callers 1

ParseQueryMethod · 0.85

Calls 3

emptyMethod · 0.45
appendMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected