* Sets the keyspace in any connection that is already opened. * @param {Client} client * @returns {Promise}
(client)
| 218 | * @returns {Promise} |
| 219 | */ |
| 220 | static setKeyspace(client) { |
| 221 | let connection; |
| 222 | |
| 223 | for (const host of client.hosts.values()) { |
| 224 | connection = host.getActiveConnection(); |
| 225 | if (connection) { |
| 226 | break; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | if (!connection) { |
| 231 | throw new errors.DriverInternalError('No active connection found'); |
| 232 | } |
| 233 | |
| 234 | return connection.changeKeyspace(client.keyspace); |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * @param {Error} err |
no test coverage detected