MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / toOneLineQuery

Function toOneLineQuery

src/Parsers/toOneLineQuery.cpp:7–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5{
6
7String toOneLineQuery(const String & query)
8{
9 String res;
10 const char * begin = query.data();
11 const char * end = begin + query.size();
12
13 Lexer lexer(begin, end);
14 Token token = lexer.nextToken();
15 for (; !token.isEnd(); token = lexer.nextToken())
16 {
17 if (token.type == TokenType::Whitespace)
18 {
19 res += ' ';
20 }
21 else if (token.type == TokenType::Comment)
22 {
23 res.append(token.begin, token.end);
24 if (token.end < end && *token.end == '\n')
25 res += '\n';
26 }
27 else
28 res.append(token.begin, token.end);
29 }
30
31 return res;
32}
33
34}

Callers 2

logQueryFunction · 0.85
logExceptionFunction · 0.85

Calls 5

dataMethod · 0.45
sizeMethod · 0.45
nextTokenMethod · 0.45
isEndMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected