MCPcopy Create free account
hub / github.com/ByConity/ByConity / wrapIdentifiersWithBackticks

Function wrapIdentifiersWithBackticks

programs/copier/Internals.cpp:193–210  ·  view source on GitHub ↗

Wraps only identifiers with backticks.

Source from the content-addressed store, hash-verified

191
192/// Wraps only identifiers with backticks.
193std::string wrapIdentifiersWithBackticks(const ASTPtr & root)
194{
195 if (auto identifier = std::dynamic_pointer_cast<ASTIdentifier>(root))
196 return backQuote(identifier->name());
197
198 if (auto function = std::dynamic_pointer_cast<ASTFunction>(root))
199 return function->name + '(' + wrapIdentifiersWithBackticks(function->arguments) + ')';
200
201 if (auto expression_list = std::dynamic_pointer_cast<ASTExpressionList>(root))
202 {
203 Names function_arguments(expression_list->children.size());
204 for (size_t i = 0; i < expression_list->children.size(); ++i)
205 function_arguments[i] = wrapIdentifiersWithBackticks(expression_list->children[0]);
206 return boost::algorithm::join(function_arguments, ", ");
207 }
208
209 throw Exception("Primary key could be represented only as columns or functions from columns.", ErrorCodes::BAD_ARGUMENTS);
210}
211
212
213Names extractPrimaryKeyColumnNames(const ASTPtr & storage_ast)

Callers 1

Calls 5

backQuoteFunction · 0.85
joinFunction · 0.50
ExceptionClass · 0.50
nameMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected