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

Method processTextAsSingleQuery

src/Client/ClientBase.cpp:1236–1275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1234}
1235
1236bool ClientBase::processTextAsSingleQuery(const String & full_query)
1237{
1238 /// Some parts of a query (result output and formatting) are executed
1239 /// client-side. Thus we need to parse the query.
1240 const char * begin = full_query.data();
1241 auto parsed_query = parseQuery(begin, begin + full_query.size(),
1242 client_context->getSettingsRef(),
1243 /*allow_multi_statements=*/ false);
1244
1245 if (!parsed_query)
1246 return false;
1247
1248 /// Query will be parsed before checking the result because error does not
1249 /// always means a problem, i.e. if table already exists, and it is no a
1250 /// huge problem if suggestion will be added even on error, since this is
1251 /// just suggestion.
1252 ///
1253 /// Do not update suggest, until suggestion will be ready
1254 /// (this will avoid extra complexity)
1255 if (suggest)
1256 updateSuggest(parsed_query);
1257
1258 try
1259 {
1260 bool is_async_insert_with_inlined_data = false;
1261 processParsedSingleQuery(full_query, parsed_query, is_async_insert_with_inlined_data);
1262 }
1263 catch (Exception & e)
1264 {
1265 if (server_exception)
1266 server_exception->rethrow();
1267 if (!is_interactive)
1268 e.addMessage("(in query: {})", full_query);
1269 throw;
1270 }
1271
1272 if (have_error)
1273 processError(full_query);
1274 return !have_error;
1275}
1276
1277void ClientBase::processOrdinaryQuery(String query, ASTPtr parsed_query)
1278{

Callers 1

processServerQueryMethod · 0.80

Calls 5

parseQueryFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
rethrowMethod · 0.45
addMessageMethod · 0.45

Tested by

no test coverage detected