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

Function buildConnectionString

src/Client/ConnectionString.cpp:63–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void buildConnectionString(
64 std::string_view host_and_port,
65 std::string_view right_part,
66 Poco::URI & uri,
67 std::vector<std::vector<std::string>> & hosts_and_ports_arguments)
68{
69 // User info does not matter in sub URI
70 auto uri_string = std::string(CONNECTION_URI_SCHEME);
71 if (!host_and_port.empty())
72 {
73 uri_string.append("//");
74 uri_string.append(host_and_port);
75 }
76
77 // Right part from string includes '/database?[params]'
78 uri_string.append(right_part);
79 try
80 {
81 uri = Poco::URI(uri_string);
82 }
83 catch (const Poco::URISyntaxException & invalid_uri_exception)
84 {
85 throw DB::Exception(DB::ErrorCodes::BAD_ARGUMENTS,
86 "Invalid connection string syntax {}: {}", uri_string, invalid_uri_exception.what());
87 }
88
89 getHostAndPort(uri, hosts_and_ports_arguments);
90}
91
92std::string makeArgument(const std::string & connection_string_parameter_name)
93{

Callers 1

tryParseConnectionStringFunction · 0.85

Calls 6

getHostAndPortFunction · 0.85
ExceptionClass · 0.70
URIClass · 0.50
emptyMethod · 0.45
appendMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected