MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / _borrowWithKeyspace

Method _borrowWithKeyspace

lib/prepare-handler.js:266–274  ·  view source on GitHub ↗

* Borrows a connection and changes the active keyspace on the connection, if needed. * It does not perform any retry or error handling. * @param {Host!} host * @param {string} keyspace * @returns {Promise } * @throws {errors.BusyConnectionError} When the connection is busy.

(host, keyspace)

Source from the content-addressed store, hash-verified

264 * @private
265 */
266 static async _borrowWithKeyspace(host, keyspace) {
267 const connection = host.borrowConnection();
268
269 if (keyspace && connection.keyspace !== keyspace) {
270 await connection.changeKeyspace(keyspace);
271 }
272
273 return connection;
274 }
275
276 /**
277 * Prepares the provided query on all hosts, except the host provided.

Callers 2

_prepareWithQueryPlanMethod · 0.80
_borrowAndPrepareMethod · 0.80

Calls 2

changeKeyspaceMethod · 0.80
borrowConnectionMethod · 0.45

Tested by

no test coverage detected