| 270 | } |
| 271 | |
| 272 | Connection::Info GetInfoCache::GetInfo(uint16_t info_type) { |
| 273 | auto it = info_.find(info_type); |
| 274 | |
| 275 | if (info_.end() == it) { |
| 276 | if (LoadInfoFromServer()) { |
| 277 | it = info_.find(info_type); |
| 278 | } |
| 279 | if (info_.end() == it) { |
| 280 | throw DriverException("Unknown GetInfo type: " + std::to_string(info_type)); |
| 281 | } |
| 282 | } |
| 283 | return it->second; |
| 284 | } |
| 285 | |
| 286 | bool GetInfoCache::LoadInfoFromServer() { |
| 287 | if (sql_client_ && !has_server_info_.exchange(true)) { |