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

Function getLineAndCol

src/Parsers/parseQuery.cpp:31–44  ·  view source on GitHub ↗

From position in (possible multiline) query, get line number and column number in line. * Used in syntax error message. */

Source from the content-addressed store, hash-verified

29 * Used in syntax error message.
30 */
31std::pair<size_t, size_t> getLineAndCol(const char * begin, const char * pos)
32{
33 size_t line = 0;
34
35 const char * nl = nullptr;
36 while ((nl = find_first_symbols<'\n'>(begin, pos)) < pos)
37 {
38 ++line;
39 begin = nl + 1;
40 }
41
42 /// Lines numbered from 1.
43 return { line + 1, pos - begin + 1 };
44}
45
46
47WriteBuffer & operator<< (WriteBuffer & out, const Expected & expected)

Callers 1

writeCommonErrorMessageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected