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

Method _prepare

lib/prepare-handler.js:103–117  ·  view source on GitHub ↗

* Prepares the query on a single host or on all hosts depending on the options. * Uses the info 'prepared' event to emit the result. * @param {Object} info * @param {String} query * @param {String} keyspace * @returns {Promise<{queryId, meta}>}

(info, query, keyspace)

Source from the content-addressed store, hash-verified

101 * @returns {Promise<{queryId, meta}>}
102 */
103 async _prepare(info, query, keyspace) {
104 info.preparing = true;
105 let iterator;
106
107 try {
108 iterator = await promiseUtils.newQueryPlan(this._loadBalancing, keyspace, null);
109 return await this._prepareWithQueryPlan(info, iterator, query, keyspace);
110 } catch (err) {
111 info.preparing = false;
112 err.query = query;
113 info.emit('prepared', err);
114
115 throw err;
116 }
117 }
118
119 /**
120 * Uses the query plan to prepare the query on the first host and optionally on the rest of the hosts.

Callers 1

getPreparedMethod · 0.95

Calls 2

_prepareWithQueryPlanMethod · 0.95
newQueryPlanMethod · 0.45

Tested by

no test coverage detected