MCPcopy Create free account
hub / github.com/apache/arrow / Connect

Method Connect

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.cc:152–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void FlightSqlConnection::Connect(const ConnPropertyMap& properties,
153 std::vector<std::string_view>& missing_attr) {
154 try {
155 auto flight_ssl_configs = LoadFlightSslConfigs(properties);
156
157 Location location = BuildLocation(properties, missing_attr, flight_ssl_configs);
158 client_options_ =
159 BuildFlightClientOptions(properties, missing_attr, flight_ssl_configs);
160
161 std::unique_ptr<FlightClient> flight_client;
162 ThrowIfNotOK(FlightClient::Connect(location, client_options_).Value(&flight_client));
163 PopulateMetadataSettings(properties);
164 PopulateCallOptions(properties);
165
166 std::unique_ptr<FlightSqlAuthMethod> auth_method =
167 FlightSqlAuthMethod::FromProperties(flight_client, properties);
168 auth_method->Authenticate(*this, call_options_);
169
170 sql_client_.reset(new FlightSqlClient(std::move(flight_client)));
171 closed_ = false;
172
173 // Note: This should likely come from Flight instead of being from the
174 // connection properties to allow reporting a user for other auth mechanisms
175 // and also decouple the database user from user credentials.
176
177 info_.SetProperty(SQL_USER_NAME, auth_method->GetUser());
178 attribute_[CONNECTION_DEAD] = static_cast<uint32_t>(SQL_FALSE);
179 } catch (...) {
180 attribute_[CONNECTION_DEAD] = static_cast<uint32_t>(SQL_TRUE);
181 sql_client_.reset();
182
183 throw;
184 }
185}
186
187void FlightSqlConnection::PopulateMetadataSettings(
188 const Connection::ConnPropertyMap& conn_property_map) {

Callers

nothing calls this directly

Calls 7

LoadFlightSslConfigsFunction · 0.85
ThrowIfNotOKFunction · 0.85
SetPropertyMethod · 0.80
ValueMethod · 0.45
AuthenticateMethod · 0.45
resetMethod · 0.45
GetUserMethod · 0.45

Tested by

no test coverage detected