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

Method getQuery

src/Server/HTTPHandler.cpp:864–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864std::string DynamicQueryHandler::getQuery(HTTPServerRequest & request, HTMLForm & params, ContextMutablePtr context)
865{
866 if (likely(!startsWith(request.getContentType(), "multipart/form-data")))
867 {
868 /// Part of the query can be passed in the 'query' parameter and the rest in the request body
869 /// (http method need not necessarily be POST). In this case the entire query consists of the
870 /// contents of the 'query' parameter, a line break and the request body.
871 std::string query_param = params.get(param_name, "");
872 return query_param.empty() ? query_param : query_param + "\n";
873 }
874
875 /// Support for "external data for query processing".
876 /// Used in case of POST request with form-data, but it isn't expected to be deleted after that scope.
877 ExternalTablesHandler handler(context, params);
878 auto input_stream = request.getStream();
879 params.load(request, *input_stream, handler);
880
881 std::string full_query;
882 /// Params are of both form params POST and uri (GET params)
883 for (const auto & it : params)
884 {
885 if (it.first == param_name)
886 {
887 full_query += it.second;
888 }
889 else
890 {
891 customizeQueryParam(context, it.first, it.second);
892 }
893 }
894
895 return full_query;
896}
897
898PredefinedQueryHandler::PredefinedQueryHandler(
899 IServer & server_,

Callers

nothing calls this directly

Calls 6

getContentTypeMethod · 0.80
startsWithFunction · 0.50
getMethod · 0.45
emptyMethod · 0.45
getStreamMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected