| 150 | } |
| 151 | |
| 152 | void 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 | |
| 187 | void FlightSqlConnection::PopulateMetadataSettings( |
| 188 | const Connection::ConnPropertyMap& conn_property_map) { |
nothing calls this directly
no test coverage detected